setup: silence warning of unknown option python_requires on distutils stable
authorYuya Nishihara <yuya@tcha.org>
Thu, 27 Jul 2017 23:15:14 +0900
branchstable
changeset 33600 47829b89c8c6
parent 33599 cfa08b06d8b5
child 33601 850d2ec2cf6a
setup: silence warning of unknown option python_requires on distutils /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'
setup.py
--- a/setup.py	Thu Jul 20 22:47:40 2017 +0900
+++ b/setup.py	Thu Jul 27 23:15:14 2017 +0900
@@ -111,7 +111,8 @@
 # We have issues with setuptools on some platforms and builders. Until
 # those are resolved, setuptools is opt-in except for platforms where
 # we don't have issues.
-if os.name == 'nt' or 'FORCE_SETUPTOOLS' in os.environ:
+issetuptools = (os.name == 'nt' or 'FORCE_SETUPTOOLS' in os.environ)
+if issetuptools:
     from setuptools import setup
 else:
     from distutils.core import setup
@@ -847,6 +848,8 @@
 
 extra = {}
 
+if issetuptools:
+    extra['python_requires'] = supportedpy
 if py2exeloaded:
     extra['console'] = [
         {'script':'hg',
@@ -946,5 +949,4 @@
                               'welcome': 'contrib/macosx/Welcome.html',
                               },
                },
-      python_requires=supportedpy,
       **extra)