Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ENH: Warn on unsupported Python 3.10+ #17443

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Oct 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 35 additions & 28 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import sys
import subprocess
import textwrap
import sysconfig
import warnings


if sys.version_info[:2] < (3, 6):
Expand All @@ -43,6 +43,7 @@
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: Implementation :: CPython
Topic :: Software Development
Expand All @@ -59,6 +60,14 @@
ISRELEASED = False
VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)

# The first version not in the `Programming Language :: Python :: ...` classifiers above
if sys.version_info >= (3, 10):
warnings.warn(
f"NumPy {VERSION} may not yet support Python "
f"{sys.version_info.major}.{sys.version_info.minor}.",
RuntimeWarning,
)


# Return the git revision as a string
def git_version():
Expand Down Expand Up @@ -88,6 +97,7 @@ def _minimal_ext_cmd(cmd):

return GIT_REVISION


# BEFORE importing setuptools, remove MANIFEST. Otherwise it may not be
# properly updated when the contents of directories change (true for distutils,
# not sure about setuptools).
Expand Down Expand Up @@ -150,7 +160,7 @@ def write_version_py(filename='numpy/version.py'):
a.close()


def configuration(parent_package='',top_path=None):
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration

config = Configuration(None, parent_package, top_path)
Expand All @@ -163,7 +173,7 @@ def configuration(parent_package='',top_path=None):
config.add_data_files(('numpy', 'LICENSE.txt'))
config.add_data_files(('numpy', 'numpy/*.pxd'))

config.get_version('numpy/version.py') # sets config.version
config.get_version('numpy/version.py') # sets config.version

return config

Expand All @@ -175,13 +185,12 @@ def check_submodules():
if not os.path.exists('.git'):
return
with open('.gitmodules') as f:
for l in f:
if 'path' in l:
p = l.split('=')[-1].strip()
for line in f:
if 'path' in line:
p = line.split('=')[-1].strip()
if not os.path.exists(p):
raise ValueError('Submodule {} missing'.format(p))


proc = subprocess.Popen(['git', 'submodule', 'status'],
stdout=subprocess.PIPE)
status, _ = proc.communicate()
Expand Down Expand Up @@ -273,9 +282,9 @@ def generate_cython():
print("Cythonizing sources")
for d in ('random',):
p = subprocess.call([sys.executable,
os.path.join(cwd, 'tools', 'cythonize.py'),
'numpy/{0}'.format(d)],
cwd=cwd)
os.path.join(cwd, 'tools', 'cythonize.py'),
'numpy/{0}'.format(d)],
cwd=cwd)
if p != 0:
raise RuntimeError("Running cythonize failed!")

Expand Down Expand Up @@ -346,7 +355,6 @@ def parse_setuppy_commands():
"""))
return False


# The following commands aren't supported. They can only be executed when
# the user explicitly adds a --force command-line argument.
bad_commands = dict(
Expand Down Expand Up @@ -384,8 +392,8 @@ def parse_setuppy_commands():
)
bad_commands['nosetests'] = bad_commands['test']
for command in ('upload_docs', 'easy_install', 'bdist', 'bdist_dumb',
'register', 'check', 'install_data', 'install_headers',
'install_lib', 'install_scripts', ):
'register', 'check', 'install_data', 'install_headers',
'install_lib', 'install_scripts', ):
bad_commands[command] = "`setup.py %s` is not supported" % command

for command in bad_commands.keys():
Expand All @@ -405,7 +413,8 @@ def parse_setuppy_commands():
# If we got here, we didn't detect what setup.py command was given
import warnings
warnings.warn("Unrecognized setuptools command, proceeding with "
"generating Cython sources and expanding templates", stacklevel=2)
"generating Cython sources and expanding templates",
stacklevel=2)
return True


Expand Down Expand Up @@ -440,25 +449,24 @@ def setup_package():
'f2py%s.%s = numpy.f2py.f2py2e:main' % sys.version_info[:2],
]

cmdclass={"sdist": sdist_checked,
}
cmdclass = {"sdist": sdist_checked, }
metadata = dict(
name = 'numpy',
maintainer = "NumPy Developers",
maintainer_email = "[email protected]",
description = DOCLINES[0],
long_description = "\n".join(DOCLINES[2:]),
url = "https://www.numpy.org",
author = "Travis E. Oliphant et al.",
download_url = "https://pypi.python.org/pypi/numpy",
name='numpy',
maintainer="NumPy Developers",
maintainer_email="[email protected]",
description=DOCLINES[0],
long_description="\n".join(DOCLINES[2:]),
url="https://www.numpy.org",
author="Travis E. Oliphant et al.",
download_url="https://pypi.python.org/pypi/numpy",
project_urls={
"Bug Tracker": "https://github.com/numpy/numpy/issues",
"Documentation": get_docs_url(),
"Source Code": "https://github.com/numpy/numpy",
},
license = 'BSD',
license='BSD',
classifiers=[_f for _f in CLASSIFIERS.split('\n') if _f],
platforms = ["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"],
platforms=["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"],
test_suite='pytest',
cmdclass=cmdclass,
python_requires='>=3.6',
Expand All @@ -479,8 +487,7 @@ def setup_package():
# patches distutils, even though we don't use it
import setuptools # noqa: F401
from numpy.distutils.core import setup
cwd = os.path.abspath(os.path.dirname(__file__))
if not 'sdist' in sys.argv:
if 'sdist' not in sys.argv:
# Generate Cython sources, unless we're generating an sdist
generate_cython()

Expand Down