contract_wrappers.py: fix ./setup.py clean
This commit is contained in:
parent
fc9c6c5434
commit
50f69f734f
@ -18,6 +18,30 @@ from setuptools.command.test import test as TestCommand
|
|||||||
BLACK_COMMAND = "black --line-length 79 "
|
BLACK_COMMAND = "black --line-length 79 "
|
||||||
|
|
||||||
|
|
||||||
|
CONTRACTS_TO_BE_WRAPPED = [
|
||||||
|
"asset_proxy_owner",
|
||||||
|
"coordinator",
|
||||||
|
"coordinator_registry",
|
||||||
|
"dummy_erc20_token",
|
||||||
|
"dummy_erc721_token",
|
||||||
|
"dutch_auction",
|
||||||
|
"erc20_proxy",
|
||||||
|
"erc20_token",
|
||||||
|
"erc721_proxy",
|
||||||
|
"erc721_token",
|
||||||
|
"eth_balance_checker",
|
||||||
|
"exchange",
|
||||||
|
"forwarder",
|
||||||
|
"i_asset_proxy",
|
||||||
|
"i_validator",
|
||||||
|
"i_wallet",
|
||||||
|
"multi_asset_proxy",
|
||||||
|
"order_validator",
|
||||||
|
"weth9",
|
||||||
|
"zrx_token",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class PreInstallCommand(distutils.command.build_py.build_py):
|
class PreInstallCommand(distutils.command.build_py.build_py):
|
||||||
"""Custom setuptools command class for pulling in generated code."""
|
"""Custom setuptools command class for pulling in generated code."""
|
||||||
|
|
||||||
@ -26,29 +50,7 @@ class PreInstallCommand(distutils.command.build_py.build_py):
|
|||||||
def run(self):
|
def run(self):
|
||||||
"""Copy files from TS build area to local src, & `black` them."""
|
"""Copy files from TS build area to local src, & `black` them."""
|
||||||
pkgdir = path.dirname(path.realpath(argv[0]))
|
pkgdir = path.dirname(path.realpath(argv[0]))
|
||||||
contracts = [
|
for contract in CONTRACTS_TO_BE_WRAPPED:
|
||||||
"asset_proxy_owner",
|
|
||||||
"coordinator",
|
|
||||||
"coordinator_registry",
|
|
||||||
"dummy_erc20_token",
|
|
||||||
"dummy_erc721_token",
|
|
||||||
"dutch_auction",
|
|
||||||
"erc20_proxy",
|
|
||||||
"erc20_token",
|
|
||||||
"erc721_proxy",
|
|
||||||
"erc721_token",
|
|
||||||
"eth_balance_checker",
|
|
||||||
"exchange",
|
|
||||||
"forwarder",
|
|
||||||
"i_asset_proxy",
|
|
||||||
"i_validator",
|
|
||||||
"i_wallet",
|
|
||||||
"multi_asset_proxy",
|
|
||||||
"order_validator",
|
|
||||||
"weth9",
|
|
||||||
"zrx_token",
|
|
||||||
]
|
|
||||||
for contract in contracts:
|
|
||||||
copy(
|
copy(
|
||||||
path.join(
|
path.join(
|
||||||
pkgdir,
|
pkgdir,
|
||||||
@ -84,7 +86,7 @@ class PreInstallCommand(distutils.command.build_py.build_py):
|
|||||||
black_command = BLACK_COMMAND + " ".join(
|
black_command = BLACK_COMMAND + " ".join(
|
||||||
[
|
[
|
||||||
f"src/zero_ex/contract_wrappers/{contract}/__init__.py"
|
f"src/zero_ex/contract_wrappers/{contract}/__init__.py"
|
||||||
for contract in contracts
|
for contract in CONTRACTS_TO_BE_WRAPPED
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
print(f"Running command `{black_command}`...")
|
print(f"Running command `{black_command}`...")
|
||||||
@ -158,8 +160,11 @@ class CleanCommandExtension(clean):
|
|||||||
rmtree(".pytest_cache", ignore_errors=True)
|
rmtree(".pytest_cache", ignore_errors=True)
|
||||||
rmtree("src/0x_contract_wrappers.egg-info", ignore_errors=True)
|
rmtree("src/0x_contract_wrappers.egg-info", ignore_errors=True)
|
||||||
# generated files:
|
# generated files:
|
||||||
remove("src/zero_ex/contract_wrappers/exchange/__init__.py")
|
for contract in CONTRACTS_TO_BE_WRAPPED:
|
||||||
remove("src/zero_ex/contract_wrappers/erc20_token/__init__.py")
|
try:
|
||||||
|
remove(f"src/zero_ex/contract_wrappers/{contract}/__init__.py")
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class TestPublishCommand(distutils.command.build_py.build_py):
|
class TestPublishCommand(distutils.command.build_py.build_py):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user