summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2020-12-31 09:37:29 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2020-12-31 09:37:29 +0900
commitb9a5c35f80c8e05cd8178bace99809eb5b129c7a (patch)
tree2abb0ff788d1bd4dd94fa061e0cceabdb6f2a729 /setup.py
parentd5925ce9bd335463f9561bdd10271fee77d2b9af (diff)
downloadpython-numpy-b9a5c35f80c8e05cd8178bace99809eb5b129c7a.tar.gz
python-numpy-b9a5c35f80c8e05cd8178bace99809eb5b129c7a.tar.bz2
python-numpy-b9a5c35f80c8e05cd8178bace99809eb5b129c7a.zip
Imported Upstream version 1.17.0upstream/1.17.0
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py66
1 files changed, 45 insertions, 21 deletions
diff --git a/setup.py b/setup.py
index 954668236..882740970 100755
--- a/setup.py
+++ b/setup.py
@@ -27,13 +27,10 @@ import subprocess
import textwrap
-if sys.version_info[:2] < (2, 7) or (3, 0) <= sys.version_info[:2] < (3, 4):
- raise RuntimeError("Python version 2.7 or >= 3.4 required.")
+if sys.version_info[:2] < (3, 5):
+ raise RuntimeError("Python version >= 3.5 required.")
-if sys.version_info[0] >= 3:
- import builtins
-else:
- import __builtin__ as builtins
+import builtins
CLASSIFIERS = """\
@@ -43,10 +40,7 @@ Intended Audience :: Developers
License :: OSI Approved
Programming Language :: C
Programming Language :: Python
-Programming Language :: Python :: 2
-Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
-Programming Language :: Python :: 3.4
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
@@ -60,8 +54,8 @@ Operating System :: MacOS
"""
MAJOR = 1
-MINOR = 16
-MICRO = 6
+MINOR = 17
+MICRO = 0
ISRELEASED = True
VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
@@ -79,13 +73,13 @@ def git_version():
env['LANGUAGE'] = 'C'
env['LANG'] = 'C'
env['LC_ALL'] = 'C'
- out = subprocess.Popen(cmd, stdout=subprocess.PIPE, env=env).communicate()[0]
+ out = subprocess.check_output(cmd, stderr=subprocess.STDOUT, env=env)
return out
try:
out = _minimal_ext_cmd(['git', 'rev-parse', 'HEAD'])
GIT_REVISION = out.strip().decode('ascii')
- except OSError:
+ except (subprocess.SubprocessError, OSError):
GIT_REVISION = "Unknown"
return GIT_REVISION
@@ -192,23 +186,52 @@ def check_submodules():
raise ValueError('Submodule not clean: %s' % line)
+class concat_license_files():
+ """Merge LICENSE.txt and LICENSES_bundled.txt for sdist creation
+
+ Done this way to keep LICENSE.txt in repo as exact BSD 3-clause (see
+ gh-13447). This makes GitHub state correctly how NumPy is licensed.
+ """
+ def __init__(self):
+ self.f1 = 'LICENSE.txt'
+ self.f2 = 'LICENSES_bundled.txt'
+
+ def __enter__(self):
+ """Concatenate files and remove LICENSES_bundled.txt"""
+ with open(self.f1, 'r') as f1:
+ self.bsd_text = f1.read()
+
+ with open(self.f1, 'a') as f1:
+ with open(self.f2, 'r') as f2:
+ self.bundled_text = f2.read()
+ f1.write('\n\n')
+ f1.write(self.bundled_text)
+
+ def __exit__(self, exception_type, exception_value, traceback):
+ """Restore content of both files"""
+ with open(self.f1, 'w') as f:
+ f.write(self.bsd_text)
+
+
from distutils.command.sdist import sdist
class sdist_checked(sdist):
""" check submodules on sdist to prevent incomplete tarballs """
def run(self):
check_submodules()
- sdist.run(self)
+ with concat_license_files():
+ sdist.run(self)
def generate_cython():
cwd = os.path.abspath(os.path.dirname(__file__))
print("Cythonizing sources")
- p = subprocess.call([sys.executable,
- os.path.join(cwd, 'tools', 'cythonize.py'),
- 'numpy/random'],
- cwd=cwd)
- if p != 0:
- raise RuntimeError("Running cythonize failed!")
+ for d in ('random',):
+ p = subprocess.call([sys.executable,
+ os.path.join(cwd, 'tools', 'cythonize.py'),
+ 'numpy/{0}'.format(d)],
+ cwd=cwd)
+ if p != 0:
+ raise RuntimeError("Running cythonize failed!")
def parse_setuppy_commands():
@@ -372,6 +395,7 @@ def setup_package():
download_url = "https://pypi.python.org/pypi/numpy",
project_urls={
"Bug Tracker": "https://github.com/numpy/numpy/issues",
+ "Documentation": "https://docs.scipy.org/doc/numpy/",
"Source Code": "https://github.com/numpy/numpy",
},
license = 'BSD',
@@ -379,7 +403,7 @@ def setup_package():
platforms = ["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"],
test_suite='nose.collector',
cmdclass={"sdist": sdist_checked},
- python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*',
+ python_requires='>=3.5',
zip_safe=False,
entry_points={
'console_scripts': f2py_cmds