From 7509ba906796a49995345d72dc2effaa8a178f11 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Wed, 29 Nov 2017 12:34:15 +0100 Subject: [PATCH] Assert that module was generated correctly on setup.py pypi --- setup.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/setup.py b/setup.py index 3f8ee7a6..0c531d70 100755 --- a/setup.py +++ b/setup.py @@ -71,6 +71,16 @@ def main(): print('Done.') elif len(argv) >= 2 and argv[1] == 'pypi': + # (Re)generate the code to make sure we don't push without it + gen_tl() + + # Try importing the telethon module to assert it has no errors + try: + import telethon + except: + print('Packaging for PyPi aborted, importing the module failed.') + return + # Need python3.5 or higher, but Telethon is supposed to support 3.x # Place it here since noone should be running ./setup.py pypi anyway from subprocess import run