mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-25 19:03:46 +03:00
Add a pypi option to setup.py to easily update the library
This commit is contained in:
parent
e12e82357d
commit
aea95a398b
12
setup.py
12
setup.py
|
@ -8,9 +8,12 @@ https://github.com/pypa/sampleproject
|
||||||
Extra supported commands are:
|
Extra supported commands are:
|
||||||
* gen_tl, to generate the classes required for Telethon to run
|
* gen_tl, to generate the classes required for Telethon to run
|
||||||
* clean_tl, to clean these generated classes
|
* clean_tl, to clean these generated classes
|
||||||
|
* pypi, to generate sdist, bdist_wheel, and push to PyPi
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# To use a consistent encoding
|
# To use a consistent encoding
|
||||||
|
from subprocess import run
|
||||||
|
from shutil import rmtree
|
||||||
from codecs import open
|
from codecs import open
|
||||||
from sys import argv
|
from sys import argv
|
||||||
from os import path
|
from os import path
|
||||||
|
@ -44,6 +47,15 @@ if __name__ == '__main__':
|
||||||
TLGenerator('telethon/tl').clean_tlobjects()
|
TLGenerator('telethon/tl').clean_tlobjects()
|
||||||
print('Done.')
|
print('Done.')
|
||||||
|
|
||||||
|
elif len(argv) >= 2 and argv[1] == 'pypi':
|
||||||
|
for x in ('build', 'dist', 'Telethon.egg-info'):
|
||||||
|
rmtree(x, ignore_errors=True)
|
||||||
|
run('python3 setup.py sdist', shell=True)
|
||||||
|
run('python3 setup.py bdist_wheel', shell=True)
|
||||||
|
run('twine upload dist/*', shell=True)
|
||||||
|
for x in ('build', 'dist', 'Telethon.egg-info'):
|
||||||
|
rmtree(x, ignore_errors=True)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if not TelegramClient:
|
if not TelegramClient:
|
||||||
print('Run `python3', argv[0], 'gen_tl` first.')
|
print('Run `python3', argv[0], 'gen_tl` first.')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user