From 4e57afbcc7b0a05d9ab92aa37bb35cb30897100d Mon Sep 17 00:00:00 2001 From: codelucas Date: Tue, 13 Jun 2017 18:37:08 -0700 Subject: [PATCH] Change setup.py format in python2 --- setup.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/setup.py b/setup.py index a5813c5..69cf8c0 100644 --- a/setup.py +++ b/setup.py @@ -19,16 +19,6 @@ def hilight(input_string): return '\x1b[%sm%s\x1b[0m' % (';'.join(attr), input_string) -# This *must* run early. Please see this API limitation on our users: -# https://github.com/codelucas/newspaper/issues/155 -if sys.version_info[0] == 3: - warning_string = hilight( - 'WARNING! You are attempting to install newspaper\'s ' - 'python2 repository on python3. PLEASE RUN ' - '`$ pip3 install newspaper3k` for python3 or ' - '`$ pip install newspaper` for python2') - sys.exit(warning_string) - try: from setuptools import setup except ImportError: @@ -40,6 +30,19 @@ if sys.argv[-1] == 'publish': sys.exit() +# This *must* run early. Please see this API limitation on our users: +# https://github.com/codelucas/newspaper/issues/155 +# But, this can't run before the `os.system('python setup.py sdist upload')` publish +# command because publishing only works in python3 for my MANIFEST.in format +if sys.version_info[0] == 3: + warning_string = hilight( + 'WARNING! You are attempting to install newspaper\'s ' + 'python2 repository on python3. PLEASE RUN ' + '`$ pip3 install newspaper3k` for python3 or ' + '`$ pip install newspaper` for python2') + sys.exit(warning_string) + + packages = [ 'newspaper', ]