|
4 | 4 |
|
5 | 5 | from setuptools import find_packages, setup
|
6 | 6 |
|
| 7 | +CURRENT_PYTHON = sys.version_info[:2] |
| 8 | +REQUIRED_PYTHON = (3, 5) |
| 9 | + |
| 10 | +# This check and everything above must remain compatible with Python 2.7. |
| 11 | +if CURRENT_PYTHON < REQUIRED_PYTHON: |
| 12 | + sys.stderr.write(""" |
| 13 | +========================== |
| 14 | +Unsupported Python version |
| 15 | +========================== |
| 16 | +
|
| 17 | +This version of Django requires Python {}.{}, but you're trying to |
| 18 | +install it on Python {}.{}. |
| 19 | +
|
| 20 | +This may be because you are using a version of pip that doesn't |
| 21 | +understand the python_requires classifier. Make sure you |
| 22 | +have pip >= 9.0 and setuptools >= 24.2, then try again: |
| 23 | +
|
| 24 | + $ python -m pip install --upgrade pip setuptools |
| 25 | + $ python -m pip install django |
| 26 | +
|
| 27 | +This will install the latest version of Django which works on your |
| 28 | +version of Python. If you can't upgrade your pip (or Python), request |
| 29 | +an older version of Django: |
| 30 | +
|
| 31 | + $ python -m pip install "django<2" |
| 32 | +""".format(*(REQUIRED_PYTHON + CURRENT_PYTHON))) |
| 33 | + sys.exit(1) |
| 34 | + |
| 35 | + |
7 | 36 | # Warn if we are installing over top of an existing installation. This can
|
8 | 37 | # cause issues where files that were deleted from a more recent Django are
|
9 | 38 | # still present in site-packages. See #18115.
|
|
35 | 64 | setup(
|
36 | 65 | name='Django',
|
37 | 66 | version=version,
|
| 67 | + python_requires='>={}.{}'.format(*REQUIRED_PYTHON), |
38 | 68 | url='https://www.djangoproject.com/',
|
39 | 69 | author='Django Software Foundation',
|
40 | 70 |
|
|
0 commit comments