mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 09:26:37 +03:00
Better clean command in setup.py
This commit is contained in:
parent
05fcbfd7b7
commit
84c197be60
10
setup.py
10
setup.py
|
@ -54,7 +54,7 @@ DOCS_IN_RES = GENERATOR_DIR / 'data/html'
|
||||||
DOCS_OUT = Path('docs')
|
DOCS_OUT = Path('docs')
|
||||||
|
|
||||||
|
|
||||||
def generate(which):
|
def generate(action, which):
|
||||||
from telethon_generator.parsers import\
|
from telethon_generator.parsers import\
|
||||||
parse_errors, parse_methods, parse_tl, find_layer
|
parse_errors, parse_methods, parse_tl, find_layer
|
||||||
|
|
||||||
|
@ -71,10 +71,8 @@ def generate(which):
|
||||||
if not which:
|
if not which:
|
||||||
which.extend(('tl', 'errors'))
|
which.extend(('tl', 'errors'))
|
||||||
|
|
||||||
clean = 'clean' in which
|
clean = action == 'clean'
|
||||||
action = 'Cleaning' if clean else 'Generating'
|
action = 'Cleaning' if clean else 'Generating'
|
||||||
if clean:
|
|
||||||
which.remove('clean')
|
|
||||||
|
|
||||||
if 'all' in which:
|
if 'all' in which:
|
||||||
which.remove('all')
|
which.remove('all')
|
||||||
|
@ -141,8 +139,8 @@ def generate(which):
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
if len(argv) >= 2 and argv[1] == 'gen':
|
if len(argv) >= 2 and argv[1] in ('gen', 'clean'):
|
||||||
generate(argv[2:])
|
generate(argv[1], argv[2:])
|
||||||
|
|
||||||
elif len(argv) >= 2 and argv[1] == 'pypi':
|
elif len(argv) >= 2 and argv[1] == 'pypi':
|
||||||
# (Re)generate the code to make sure we don't push without it
|
# (Re)generate the code to make sure we don't push without it
|
||||||
|
|
|
@ -737,7 +737,7 @@ def generate_tlobjects(tlobjects, layer, import_depth, output_dir):
|
||||||
|
|
||||||
|
|
||||||
def clean_tlobjects(output_dir):
|
def clean_tlobjects(output_dir):
|
||||||
for d in ('functions', 'types'):
|
for d in ('functions', 'types', 'patched'):
|
||||||
d = output_dir / d
|
d = output_dir / d
|
||||||
if d.is_dir():
|
if d.is_dir():
|
||||||
shutil.rmtree(str(d))
|
shutil.rmtree(str(d))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user