diff options
Diffstat (limited to 'setup.py')
| -rw-r--r-- | setup.py | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -1,9 +1,25 @@ from distutils.core import setup from distutils.command.install_data import install_data from distutils.command.install import INSTALL_SCHEMES +from distutils.sysconfig import get_python_lib import os import sys +# 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 +# still present in site-packages. See #18115. +overlay_warning = False +if "install" in sys.argv: + # We have to try also with an explicit prefix of /usr/local in order to + # catch Debian's custom user site-packages directory. + for lib_path in get_python_lib(), get_python_lib(prefix="/usr/local"): + existing_path = os.path.abspath(os.path.join(lib_path, "django")) + if os.path.exists(existing_path): + # We note the need for the warning here, but present it after the + # command is run, so it's more likely to be seen. + overlay_warning = True + break + class osx_install_data(install_data): # On MacOS, the platform-specific lib dir is /System/Library/Framework/Python/.../ # which is wrong. Python 2.5 supplied with MacOS 10.5 has an Apple-specific fix @@ -97,3 +113,23 @@ setup( 'Topic :: Software Development :: Libraries :: Python Modules', ], ) + +if overlay_warning: + sys.stderr.write(""" + +======== +WARNING! +======== + +You have just installed Django over top of an existing +installation, without removing it first. Because of this, +your install may now include extraneous files from a +previous version that have since been removed from +Django. This is known to cause a variety of problems. You +should manually remove the + +%(existing_path)s + +directory and re-install Django. + +""" % { "existing_path": existing_path }) |
