From 6ed7d40727f70934df6ab0ac96f5f1c4f01c534f Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Mon, 21 May 2012 17:28:58 -0600 Subject: Fixed #18115 - added warning about overlaid install. Setup.py now warns if it detects that Django is being installed over top of a previous installation that was never removed. This should only happen when installing with ``python setup.py install``, as pip automatically uninstalls before installing a new version and easy_install installs as an egg directory. Also generally updated the installation doc. --- setup.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'setup.py') diff --git a/setup.py b/setup.py index a19f660a5a..165c5e9f73 100644 --- a/setup.py +++ b/setup.py @@ -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 }) -- cgit v1.3