summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorCarl Meyer <carl@oddbird.net>2012-05-21 17:28:58 -0600
committerCarl Meyer <carl@oddbird.net>2012-05-21 17:28:58 -0600
commit6ed7d40727f70934df6ab0ac96f5f1c4f01c534f (patch)
treec6e863193db176c894157e5d7cd029519047d2b4 /setup.py
parent23b941845887e3b967d76cb115d3bc51e7310b71 (diff)
downloaddjango-6ed7d40727f70934df6ab0ac96f5f1c4f01c534f.tar.gz
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.
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py36
1 files changed, 36 insertions, 0 deletions
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 })