mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 17:36:34 +03:00
Call gen_tl() when installing through setup.py (#530)
This commit is contained in:
parent
36e2101910
commit
2ccb6063e0
8
setup.py
8
setup.py
|
@ -45,11 +45,13 @@ GENERATOR_DIR = 'telethon/tl'
|
||||||
IMPORT_DEPTH = 2
|
IMPORT_DEPTH = 2
|
||||||
|
|
||||||
|
|
||||||
def gen_tl():
|
def gen_tl(force=True):
|
||||||
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(GENERATOR_DIR)
|
generator = TLGenerator(GENERATOR_DIR)
|
||||||
if generator.tlobjects_exist():
|
if generator.tlobjects_exist():
|
||||||
|
if not force:
|
||||||
|
return
|
||||||
print('Detected previous TLObjects. Cleaning...')
|
print('Detected previous TLObjects. Cleaning...')
|
||||||
generator.clean_tlobjects()
|
generator.clean_tlobjects()
|
||||||
|
|
||||||
|
@ -99,6 +101,10 @@ def main():
|
||||||
fetch_errors(ERRORS_JSON)
|
fetch_errors(ERRORS_JSON)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
# Call gen_tl() if the scheme.tl file exists, e.g. install from GitHub
|
||||||
|
if os.path.isfile(SCHEME_TL):
|
||||||
|
gen_tl(force=False)
|
||||||
|
|
||||||
# Get the long description from the README file
|
# Get the long description from the README file
|
||||||
with open('README.rst', encoding='utf-8') as f:
|
with open('README.rst', encoding='utf-8') as f:
|
||||||
long_description = f.read()
|
long_description = f.read()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user