Commit 4391718f authored by Florian Apolloner's avatar Florian Apolloner Committed by Jannis Leidel
Browse files

[1.5.x] Fixed #19252 -- Added support for wheel packages.



Backport from master (a5becad9).

Signed-off-by: default avatarJannis Leidel <jannis@leidel.info>
parent 8b345614
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -10,7 +10,9 @@ recursive-include docs *
recursive-include scripts *
recursive-include extras *
recursive-include tests *
recursive-include django/conf/app_template *
recursive-include django/conf/locale *
recursive-include django/conf/project_template *
recursive-include django/contrib/*/locale *
recursive-include django/contrib/admin/templates *
recursive-include django/contrib/admin/static *

django/bin/__init__.py

deleted100644 → 0
+0 −0

Empty file deleted.

extras/Makefile

0 → 100644
+9 −0
Original line number Diff line number Diff line
all: sdist bdist_wheel

sdist:
	python setup.py sdist

bdist_wheel:
	python -c "import setuptools;__file__='setup.py';exec(compile(open(__file__).read().replace('\\r\\n', '\\n'), __file__, 'exec'))" bdist_wheel

.PHONY : sdist bdist_wheel
+5 −0
Original line number Diff line number Diff line
@@ -2,3 +2,8 @@
doc_files = docs extras AUTHORS INSTALL LICENSE README.rst
install-script = scripts/rpm-install.sh

[metadata]
license-file = LICENSE

[wheel]
universal = 1 #  use py2.py3 tag for pure-python dist
+46 −52
Original line number Diff line number Diff line
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.
@@ -20,28 +19,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 = []
@@ -52,15 +34,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)
@@ -69,32 +59,36 @@ 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",
    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.',
    description=('A high-level Python Web framework that encourages '
                 'rapid development and clean, pragmatic design.'),
    download_url='https://www.djangoproject.com/m/releases/1.5/Django-1.5.1.tar.gz',
    license = "BSD",
    license='BSD',
    packages=packages,
    cmdclass = cmdclasses,
    data_files = data_files,
    package_data=package_data,
    scripts=['django/bin/django-admin.py'],
    classifiers=[
        'Development Status :: 5 - Production/Stable',