[2.0.x] Fixed #28878 -- Added python_requires in setup.py and a warning for older pips that don't recognize it.
Backport of 32ade4d73b
from master
This commit is contained in:
parent
b40a1d774d
commit
45d89856fc
1
AUTHORS
1
AUTHORS
|
@ -841,6 +841,7 @@ answer newbie questions, and generally made Django that much better:
|
||||||
ymasuda@ethercube.com
|
ymasuda@ethercube.com
|
||||||
Yoong Kang Lim <yoongkang.lim@gmail.com>
|
Yoong Kang Lim <yoongkang.lim@gmail.com>
|
||||||
Yusuke Miyazaki <miyazaki.dev@gmail.com>
|
Yusuke Miyazaki <miyazaki.dev@gmail.com>
|
||||||
|
Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
|
||||||
Zachary Voase <zacharyvoase@gmail.com>
|
Zachary Voase <zacharyvoase@gmail.com>
|
||||||
Zach Liu <zachliu@gmail.com>
|
Zach Liu <zachliu@gmail.com>
|
||||||
Zach Thompson <zthompson47@gmail.com>
|
Zach Thompson <zthompson47@gmail.com>
|
||||||
|
|
30
setup.py
30
setup.py
|
@ -4,6 +4,35 @@ from distutils.sysconfig import get_python_lib
|
||||||
|
|
||||||
from setuptools import find_packages, setup
|
from setuptools import find_packages, setup
|
||||||
|
|
||||||
|
CURRENT_PYTHON = sys.version_info[:2]
|
||||||
|
REQUIRED_PYTHON = (3, 4)
|
||||||
|
|
||||||
|
# This check and everything above must remain compatible with Python 2.7.
|
||||||
|
if CURRENT_PYTHON < REQUIRED_PYTHON:
|
||||||
|
sys.stderr.write("""
|
||||||
|
==========================
|
||||||
|
Unsupported Python version
|
||||||
|
==========================
|
||||||
|
|
||||||
|
This version of Django requires Python {}.{}, but you're trying to
|
||||||
|
install it on Python {}.{}.
|
||||||
|
|
||||||
|
This may be because you are using a version of pip that doesn't
|
||||||
|
understand the python_requires classifier. Make sure you
|
||||||
|
have pip >= 9.0 and setuptools >= 24.2, then try again:
|
||||||
|
|
||||||
|
$ python -m pip install --upgrade pip setuptools
|
||||||
|
$ python -m pip install django
|
||||||
|
|
||||||
|
This will install the latest version of Django which works on your
|
||||||
|
version of Python. If you can't upgrade your pip (or Python), request
|
||||||
|
an older version of Django:
|
||||||
|
|
||||||
|
$ python -m pip install "django<2"
|
||||||
|
""".format(*(REQUIRED_PYTHON + CURRENT_PYTHON)))
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
# Warn if we are installing over top of an existing installation. This can
|
# Warn if we are installing over top of an existing installation. This can
|
||||||
# cause issues where files that were deleted from a more recent Django are
|
# cause issues where files that were deleted from a more recent Django are
|
||||||
# still present in site-packages. See #18115.
|
# still present in site-packages. See #18115.
|
||||||
|
@ -35,6 +64,7 @@ version = __import__('django').get_version()
|
||||||
setup(
|
setup(
|
||||||
name='Django',
|
name='Django',
|
||||||
version=version,
|
version=version,
|
||||||
|
python_requires='>={}.{}'.format(*REQUIRED_PYTHON),
|
||||||
url='https://www.djangoproject.com/',
|
url='https://www.djangoproject.com/',
|
||||||
author='Django Software Foundation',
|
author='Django Software Foundation',
|
||||||
author_email='foundation@djangoproject.com',
|
author_email='foundation@djangoproject.com',
|
||||||
|
|
Loading…
Reference in New Issue