Use more constants in setup.py

This commit is contained in:
Lonami Exo 2017-10-20 17:32:30 +02:00
parent be9358282a
commit 83595a0e2d

View File

@ -46,13 +46,14 @@ ERROR_LIST = 'telethon/errors/rpc_error_list.py'
ERRORS_JSON = 'telethon_generator/errors.json' ERRORS_JSON = 'telethon_generator/errors.json'
ERRORS_DESC = 'telethon_generator/error_descriptions' ERRORS_DESC = 'telethon_generator/error_descriptions'
SCHEME_TL = 'telethon_generator/scheme.tl' SCHEME_TL = 'telethon_generator/scheme.tl'
GENERATOR_DIR = 'telethon/tl'
IMPORT_DEPTH = 2 IMPORT_DEPTH = 2
def gen_tl(): def gen_tl():
from telethon_generator.tl_generator import TLGenerator from telethon_generator.tl_generator import TLGenerator
from telethon_generator.error_generator import generate_code from telethon_generator.error_generator import generate_code
generator = TLGenerator('telethon/tl') generator = TLGenerator(GENERATOR_DIR)
if generator.tlobjects_exist(): if generator.tlobjects_exist():
print('Detected previous TLObjects. Cleaning...') print('Detected previous TLObjects. Cleaning...')
generator.clean_tlobjects() generator.clean_tlobjects()
@ -71,7 +72,7 @@ def main():
elif len(argv) >= 2 and argv[1] == 'clean_tl': elif len(argv) >= 2 and argv[1] == 'clean_tl':
from telethon_generator.tl_generator import TLGenerator from telethon_generator.tl_generator import TLGenerator
print('Cleaning...') print('Cleaning...')
TLGenerator('telethon/tl').clean_tlobjects() TLGenerator(GENERATOR_DIR).clean_tlobjects()
print('Done.') print('Done.')
elif len(argv) >= 2 and argv[1] == 'pypi': elif len(argv) >= 2 and argv[1] == 'pypi':