2006-10-16 23:50:46 +02:00
|
|
|
from distutils.core import setup
|
2008-07-21 18:30:32 +02:00
|
|
|
from distutils.command.install_data import install_data
|
2006-10-16 23:50:46 +02:00
|
|
|
from distutils.command.install import INSTALL_SCHEMES
|
2012-05-22 01:28:58 +02:00
|
|
|
from distutils.sysconfig import get_python_lib
|
2006-10-16 23:50:46 +02:00
|
|
|
import os
|
2006-12-30 07:17:21 +01:00
|
|
|
import sys
|
2005-07-15 21:49:10 +02:00
|
|
|
|
2012-05-22 01:28:58 +02:00
|
|
|
# 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
|
|
|
|
|
2008-07-21 18:30:32 +02:00
|
|
|
class osx_install_data(install_data):
|
2008-07-22 04:51:59 +02:00
|
|
|
# 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
|
|
|
|
# for this in distutils.command.install_data#306. It fixes install_lib but not
|
2008-07-21 18:30:32 +02:00
|
|
|
# install_data, which is why we roll our own install_data class.
|
|
|
|
|
2008-07-22 04:51:59 +02:00
|
|
|
def finalize_options(self):
|
|
|
|
# By the time finalize_options is called, install.install_lib is set to the
|
|
|
|
# fixed directory, so we set the installdir to install_lib. The
|
2008-07-21 18:30:32 +02:00
|
|
|
# install_data class uses ('install_data', 'install_dir') instead.
|
|
|
|
self.set_undefined_options('install', ('install_lib', 'install_dir'))
|
|
|
|
install_data.finalize_options(self)
|
|
|
|
|
2012-01-07 20:05:29 +01:00
|
|
|
if sys.platform == "darwin":
|
|
|
|
cmdclasses = {'install_data': osx_install_data}
|
|
|
|
else:
|
|
|
|
cmdclasses = {'install_data': install_data}
|
2008-07-21 18:30:32 +02:00
|
|
|
|
2007-04-03 14:28:19 +02:00
|
|
|
def fullsplit(path, result=None):
|
|
|
|
"""
|
|
|
|
Split a pathname into components (the opposite of os.path.join) in a
|
|
|
|
platform-neutral way.
|
|
|
|
"""
|
|
|
|
if result is None:
|
|
|
|
result = []
|
|
|
|
head, tail = os.path.split(path)
|
|
|
|
if head == '':
|
|
|
|
return [tail] + result
|
|
|
|
if head == path:
|
|
|
|
return result
|
|
|
|
return fullsplit(head, [tail] + result)
|
|
|
|
|
2012-03-05 09:47:22 +01:00
|
|
|
# Tell distutils not to put the data_files in platform-specific installation
|
2006-10-16 23:50:46 +02:00
|
|
|
# locations. See here for an explanation:
|
|
|
|
# http://groups.google.com/group/comp.lang.python/browse_thread/thread/35ec7b2fed36eaec/2105ee4d9e8042cb
|
|
|
|
for scheme in INSTALL_SCHEMES.values():
|
|
|
|
scheme['data'] = scheme['purelib']
|
|
|
|
|
|
|
|
# Compile the list of packages available, because distutils doesn't have
|
|
|
|
# an easy way to do this.
|
|
|
|
packages, data_files = [], []
|
2006-11-27 02:12:55 +01:00
|
|
|
root_dir = os.path.dirname(__file__)
|
2008-02-21 21:50:07 +01:00
|
|
|
if root_dir != '':
|
|
|
|
os.chdir(root_dir)
|
|
|
|
django_dir = 'django'
|
2006-11-27 02:12:55 +01:00
|
|
|
|
|
|
|
for dirpath, dirnames, filenames in os.walk(django_dir):
|
2006-10-16 23:50:46 +02:00
|
|
|
# Ignore dirnames that start with '.'
|
|
|
|
for i, dirname in enumerate(dirnames):
|
|
|
|
if dirname.startswith('.'): del dirnames[i]
|
|
|
|
if '__init__.py' in filenames:
|
2008-02-21 21:50:07 +01:00
|
|
|
packages.append('.'.join(fullsplit(dirpath)))
|
2007-04-03 14:28:19 +02:00
|
|
|
elif filenames:
|
2006-12-30 07:17:21 +01:00
|
|
|
data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]])
|
|
|
|
|
2008-08-12 04:15:00 +02:00
|
|
|
# Small hack for working with bdist_wininst.
|
|
|
|
# See http://mail.python.org/pipermail/distutils-sig/2004-August/004134.html
|
|
|
|
if len(sys.argv) > 1 and sys.argv[1] == 'bdist_wininst':
|
|
|
|
for file_info in data_files:
|
|
|
|
file_info[0] = '\\PURELIB\\%s' % file_info[0]
|
|
|
|
|
2006-12-13 07:07:15 +01:00
|
|
|
# Dynamically calculate the version based on django.VERSION.
|
2012-01-08 16:05:15 +01:00
|
|
|
version = __import__('django').get_version()
|
2006-12-13 07:07:15 +01:00
|
|
|
|
2005-07-15 21:49:10 +02:00
|
|
|
setup(
|
2005-11-16 03:57:38 +01:00
|
|
|
name = "Django",
|
2012-01-07 20:05:29 +01:00
|
|
|
version = version,
|
2005-07-15 21:49:10 +02:00
|
|
|
url = 'http://www.djangoproject.com/',
|
2008-06-17 16:53:24 +02:00
|
|
|
author = 'Django Software Foundation',
|
|
|
|
author_email = 'foundation@djangoproject.com',
|
2005-07-15 21:49:10 +02:00
|
|
|
description = 'A high-level Python Web framework that encourages rapid development and clean, pragmatic design.',
|
2012-03-23 17:53:23 +01:00
|
|
|
download_url = 'https://www.djangoproject.com/m/releases/1.4/Django-1.4.tar.gz',
|
2006-10-16 23:50:46 +02:00
|
|
|
packages = packages,
|
2008-07-21 18:30:32 +02:00
|
|
|
cmdclass = cmdclasses,
|
2006-10-16 23:50:46 +02:00
|
|
|
data_files = data_files,
|
2005-07-15 22:46:05 +02:00
|
|
|
scripts = ['django/bin/django-admin.py'],
|
2011-03-28 04:14:19 +02:00
|
|
|
classifiers = [
|
2012-03-23 17:53:23 +01:00
|
|
|
'Development Status :: 5 - Production/Stable',
|
2011-03-28 04:14:19 +02:00
|
|
|
'Environment :: Web Environment',
|
|
|
|
'Framework :: Django',
|
|
|
|
'Intended Audience :: Developers',
|
|
|
|
'License :: OSI Approved :: BSD License',
|
|
|
|
'Operating System :: OS Independent',
|
|
|
|
'Programming Language :: Python',
|
|
|
|
'Programming Language :: Python :: 2.6',
|
|
|
|
'Programming Language :: Python :: 2.7',
|
|
|
|
'Topic :: Internet :: WWW/HTTP',
|
|
|
|
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
|
|
|
|
'Topic :: Internet :: WWW/HTTP :: WSGI',
|
|
|
|
'Topic :: Software Development :: Libraries :: Application Frameworks',
|
|
|
|
'Topic :: Software Development :: Libraries :: Python Modules',
|
|
|
|
],
|
2005-07-15 21:49:10 +02:00
|
|
|
)
|
2012-05-22 01:28:58 +02:00
|
|
|
|
|
|
|
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 })
|