contract_wrappers.py: fix ./setup.py clean
This commit is contained in:
parent
fc9c6c5434
commit
50f69f734f
@ -18,15 +18,7 @@ from setuptools.command.test import test as TestCommand
|
|||||||
BLACK_COMMAND = "black --line-length 79 "
|
BLACK_COMMAND = "black --line-length 79 "
|
||||||
|
|
||||||
|
|
||||||
class PreInstallCommand(distutils.command.build_py.build_py):
|
CONTRACTS_TO_BE_WRAPPED = [
|
||||||
"""Custom setuptools command class for pulling in generated code."""
|
|
||||||
|
|
||||||
description = "Pull in code generated by TypeScript"
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
"""Copy files from TS build area to local src, & `black` them."""
|
|
||||||
pkgdir = path.dirname(path.realpath(argv[0]))
|
|
||||||
contracts = [
|
|
||||||
"asset_proxy_owner",
|
"asset_proxy_owner",
|
||||||
"coordinator",
|
"coordinator",
|
||||||
"coordinator_registry",
|
"coordinator_registry",
|
||||||
@ -48,7 +40,17 @@ class PreInstallCommand(distutils.command.build_py.build_py):
|
|||||||
"weth9",
|
"weth9",
|
||||||
"zrx_token",
|
"zrx_token",
|
||||||
]
|
]
|
||||||
for contract in contracts:
|
|
||||||
|
|
||||||
|
class PreInstallCommand(distutils.command.build_py.build_py):
|
||||||
|
"""Custom setuptools command class for pulling in generated code."""
|
||||||
|
|
||||||
|
description = "Pull in code generated by TypeScript"
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
"""Copy files from TS build area to local src, & `black` them."""
|
||||||
|
pkgdir = path.dirname(path.realpath(argv[0]))
|
||||||
|
for contract in CONTRACTS_TO_BE_WRAPPED:
|
||||||
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