|
@@ -1,10 +1,9 @@
|
|
|
-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
|
|
|
|
|
|
+from distutils.core import setup
|
|
|
+from distutils.sysconfig import get_python_lib
|
|
|
+
|
|
|
# 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.
|
|
@@ -23,28 +22,11 @@ if "install" in sys.argv:
|
|
|
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
|
|
|
- # for this in distutils.command.install_data#306. It fixes install_lib but not
|
|
|
- # install_data, which is why we roll our own install_data class.
|
|
|
-
|
|
|
- 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
|
|
|
- # install_data class uses ('install_data', 'install_dir') instead.
|
|
|
- self.set_undefined_options('install', ('install_lib', 'install_dir'))
|
|
|
- install_data.finalize_options(self)
|
|
|
-
|
|
|
-if sys.platform == "darwin":
|
|
|
- cmdclasses = {'install_data': osx_install_data}
|
|
|
-else:
|
|
|
- cmdclasses = {'install_data': install_data}
|
|
|
|
|
|
def fullsplit(path, result=None):
|
|
|
"""
|
|
|
- Split a pathname into components (the opposite of os.path.join) in a
|
|
|
- platform-neutral way.
|
|
|
+ Split a pathname into components (the opposite of os.path.join)
|
|
|
+ in a platform-neutral way.
|
|
|
"""
|
|
|
if result is None:
|
|
|
result = []
|
|
@@ -55,15 +37,23 @@ def fullsplit(path, result=None):
|
|
|
return result
|
|
|
return fullsplit(head, [tail] + result)
|
|
|
|
|
|
-# Tell distutils not to put the data_files in platform-specific installation
|
|
|
-# 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']
|
|
|
+
|
|
|
+EXCLUDE_FROM_PACKAGES = ['django.conf.project_template',
|
|
|
+ 'django.conf.app_template',
|
|
|
+ 'django.bin']
|
|
|
+
|
|
|
+
|
|
|
+def is_package(package_name):
|
|
|
+ for pkg in EXCLUDE_FROM_PACKAGES:
|
|
|
+ if package_name.startswith(pkg):
|
|
|
+ return False
|
|
|
+ return True
|
|
|
+
|
|
|
|
|
|
# Compile the list of packages available, because distutils doesn't have
|
|
|
# an easy way to do this.
|
|
|
-packages, data_files = [], []
|
|
|
+packages, package_data = [], {}
|
|
|
+
|
|
|
root_dir = os.path.dirname(__file__)
|
|
|
if root_dir != '':
|
|
|
os.chdir(root_dir)
|
|
@@ -72,33 +62,37 @@ django_dir = 'django'
|
|
|
for dirpath, dirnames, filenames in os.walk(django_dir):
|
|
|
# Ignore PEP 3147 cache dirs and those whose names start with '.'
|
|
|
dirnames[:] = [d for d in dirnames if not d.startswith('.') and d != '__pycache__']
|
|
|
- if '__init__.py' in filenames:
|
|
|
- packages.append('.'.join(fullsplit(dirpath)))
|
|
|
+ parts = fullsplit(dirpath)
|
|
|
+ package_name = '.'.join(parts)
|
|
|
+ if '__init__.py' in filenames and is_package(package_name):
|
|
|
+ packages.append(package_name)
|
|
|
elif filenames:
|
|
|
- data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]])
|
|
|
+ relative_path = []
|
|
|
+ while '.'.join(parts) not in packages:
|
|
|
+ relative_path.append(parts.pop())
|
|
|
+ relative_path.reverse()
|
|
|
+ path = os.path.join(*relative_path)
|
|
|
+ package_files = package_data.setdefault('.'.join(parts), [])
|
|
|
+ package_files.extend([os.path.join(path, f) for f in filenames])
|
|
|
|
|
|
-# 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]
|
|
|
|
|
|
# Dynamically calculate the version based on django.VERSION.
|
|
|
version = __import__('django').get_version()
|
|
|
|
|
|
+
|
|
|
setup(
|
|
|
- name = "Django",
|
|
|
- version = version,
|
|
|
- url = 'http://www.djangoproject.com/',
|
|
|
- author = 'Django Software Foundation',
|
|
|
- author_email = 'foundation@djangoproject.com',
|
|
|
- description = 'A high-level Python Web framework that encourages rapid development and clean, pragmatic design.',
|
|
|
- license = "BSD",
|
|
|
- packages = packages,
|
|
|
- cmdclass = cmdclasses,
|
|
|
- data_files = data_files,
|
|
|
- scripts = ['django/bin/django-admin.py'],
|
|
|
- classifiers = [
|
|
|
+ name='Django',
|
|
|
+ version=version,
|
|
|
+ url='http://www.djangoproject.com/',
|
|
|
+ author='Django Software Foundation',
|
|
|
+ author_email='foundation@djangoproject.com',
|
|
|
+ description=('A high-level Python Web framework that encourages '
|
|
|
+ 'rapid development and clean, pragmatic design.'),
|
|
|
+ license='BSD',
|
|
|
+ packages=packages,
|
|
|
+ package_data=package_data,
|
|
|
+ scripts=['django/bin/django-admin.py'],
|
|
|
+ classifiers=[
|
|
|
'Development Status :: 5 - Production/Stable',
|
|
|
'Environment :: Web Environment',
|
|
|
'Framework :: Django',
|
|
@@ -115,7 +109,7 @@ setup(
|
|
|
'Topic :: Internet :: WWW/HTTP :: WSGI',
|
|
|
'Topic :: Software Development :: Libraries :: Application Frameworks',
|
|
|
'Topic :: Software Development :: Libraries :: Python Modules',
|
|
|
- ],
|
|
|
+ ],
|
|
|
)
|
|
|
|
|
|
if overlay_warning:
|
|
@@ -136,4 +130,4 @@ should manually remove the
|
|
|
|
|
|
directory and re-install Django.
|
|
|
|
|
|
-""" % { "existing_path": existing_path })
|
|
|
+""" % {"existing_path": existing_path})
|