Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #19252 -- Added support for wheel packages.

Signed-off-by: Jannis Leidel <jannis@leidel.info>
  • Loading branch information...
commit a5becad9094e5c5403b692b9a7b3a6ffaabf64a3 1 parent ce45240
Florian Apolloner authored April 03, 2013 jezdez committed May 01, 2013
2  MANIFEST.in
@@ -10,7 +10,9 @@ recursive-include docs *
10 10
 recursive-include scripts *
11 11
 recursive-include extras *
12 12
 recursive-include tests *
  13
+recursive-include django/conf/app_template *
13 14
 recursive-include django/conf/locale *
  15
+recursive-include django/conf/project_template *
14 16
 recursive-include django/contrib/*/locale *
15 17
 recursive-include django/contrib/admin/templates *
16 18
 recursive-include django/contrib/admin/static *
0  django/bin/__init__.py
No changes.
13  docs/internals/howto-release-django.txt
@@ -175,13 +175,13 @@ OK, this is the fun part, where we actually push out a release!
175 175
 
176 176
 #. Make sure you have an absolutely clean tree by running ``git clean -dfx``.
177 177
 
178  
-#. Run ``python setup.py sdist`` to generate the release package. This will
179  
-   create the release package in a ``dist/`` directory.
  178
+#. Run ``make -f extras/Makefile`` to generate the release packages. This will
  179
+   create the release packages in a ``dist/`` directory.
180 180
 
181  
-#. Generate the hashes of the release package::
  181
+#. Generate the hashes of the release packages::
182 182
 
183  
-        $ md5sum dist/Django-<version>.tar.gz
184  
-        $ sha1sum dist/Django-<version>.tar.gz
  183
+        $ md5sum dist/Django-*
  184
+        $ sha1sum dist/Django-*
185 185
 
186 186
    *FIXME: perhaps we should switch to sha256?*
187 187
 
@@ -221,6 +221,9 @@ Now you're ready to actually put the release out there. To do this:
221 221
         $ mktmpenv
222 222
         $ pip install https://www.djangoproject.com/m/releases/1.5/Django-1.5.1.tar.gz
223 223
         $ deactivate
  224
+        $ mktmpenv
  225
+        $ pip install https://www.djangoproject.com/m/releases/1.5/Django-1.5.1-py2.py3-none-any.whl
  226
+        $ deactivate
224 227
 
225 228
    This just tests that the tarballs are available (i.e. redirects are up) and
226 229
    that they install correctly, but it'll catch silly mistakes.
9  extras/Makefile
... ...
@@ -0,0 +1,9 @@
  1
+all: sdist bdist_wheel
  2
+
  3
+sdist:
  4
+	python setup.py sdist
  5
+
  6
+bdist_wheel:
  7
+	python -c "import setuptools;__file__='setup.py';exec(compile(open(__file__).read().replace('\\r\\n', '\\n'), __file__, 'exec'))" bdist_wheel
  8
+
  9
+.PHONY : sdist bdist_wheel
5  setup.cfg
@@ -2,3 +2,8 @@
2 2
 doc_files = docs extras AUTHORS INSTALL LICENSE README.rst
3 3
 install-script = scripts/rpm-install.sh
4 4
 
  5
+[metadata]
  6
+license-file = LICENSE
  7
+
  8
+[wheel]
  9
+universal = 1 #  use py2.py3 tag for pure-python dist
96  setup.py
... ...
@@ -1,10 +1,9 @@
1  
-from distutils.core import setup
2  
-from distutils.command.install_data import install_data
3  
-from distutils.command.install import INSTALL_SCHEMES
4  
-from distutils.sysconfig import get_python_lib
5 1
 import os
6 2
 import sys
7 3
 
  4
+from distutils.core import setup
  5
+from distutils.sysconfig import get_python_lib
  6
+
8 7
 # Warn if we are installing over top of an existing installation. This can
9 8
 # cause issues where files that were deleted from a more recent Django are
10 9
 # still present in site-packages. See #18115.
@@ -23,28 +22,11 @@
23 22
             overlay_warning = True
24 23
             break
25 24
 
26  
-class osx_install_data(install_data):
27  
-    # On MacOS, the platform-specific lib dir is /System/Library/Framework/Python/.../
28  
-    # which is wrong. Python 2.5 supplied with MacOS 10.5 has an Apple-specific fix
29  
-    # for this in distutils.command.install_data#306. It fixes install_lib but not
30  
-    # install_data, which is why we roll our own install_data class.
31  
-
32  
-    def finalize_options(self):
33  
-        # By the time finalize_options is called, install.install_lib is set to the
34  
-        # fixed directory, so we set the installdir to install_lib. The
35  
-        # install_data class uses ('install_data', 'install_dir') instead.
36  
-        self.set_undefined_options('install', ('install_lib', 'install_dir'))
37  
-        install_data.finalize_options(self)
38  
-
39  
-if sys.platform == "darwin":
40  
-    cmdclasses = {'install_data': osx_install_data}
41  
-else:
42  
-    cmdclasses = {'install_data': install_data}
43 25
 
44 26
 def fullsplit(path, result=None):
45 27
     """
46  
-    Split a pathname into components (the opposite of os.path.join) in a
47  
-    platform-neutral way.
  28
+    Split a pathname into components (the opposite of os.path.join)
  29
+    in a platform-neutral way.
48 30
     """
49 31
     if result is None:
50 32
         result = []
@@ -55,15 +37,23 @@ def fullsplit(path, result=None):
55 37
         return result
56 38
     return fullsplit(head, [tail] + result)
57 39
 
58  
-# Tell distutils not to put the data_files in platform-specific installation
59  
-# locations. See here for an explanation:
60  
-# http://groups.google.com/group/comp.lang.python/browse_thread/thread/35ec7b2fed36eaec/2105ee4d9e8042cb
61  
-for scheme in INSTALL_SCHEMES.values():
62  
-    scheme['data'] = scheme['purelib']
  40
+
  41
+EXCLUDE_FROM_PACKAGES = ['django.conf.project_template',
  42
+                         'django.conf.app_template',
  43
+                         'django.bin']
  44
+
  45
+
  46
+def is_package(package_name):
  47
+    for pkg in EXCLUDE_FROM_PACKAGES:
  48
+        if package_name.startswith(pkg):
  49
+            return False
  50
+    return True
  51
+
63 52
 
64 53
 # Compile the list of packages available, because distutils doesn't have
65 54
 # an easy way to do this.
66  
-packages, data_files = [], []
  55
+packages, package_data = [], {}
  56
+
67 57
 root_dir = os.path.dirname(__file__)
68 58
 if root_dir != '':
69 59
     os.chdir(root_dir)
@@ -72,33 +62,37 @@ def fullsplit(path, result=None):
72 62
 for dirpath, dirnames, filenames in os.walk(django_dir):
73 63
     # Ignore PEP 3147 cache dirs and those whose names start with '.'
74 64
     dirnames[:] = [d for d in dirnames if not d.startswith('.') and d != '__pycache__']
75  
-    if '__init__.py' in filenames:
76  
-        packages.append('.'.join(fullsplit(dirpath)))
  65
+    parts = fullsplit(dirpath)
  66
+    package_name = '.'.join(parts)
  67
+    if '__init__.py' in filenames and is_package(package_name):
  68
+        packages.append(package_name)
77 69
     elif filenames:
78  
-        data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]])
  70
+        relative_path = []
  71
+        while '.'.join(parts) not in packages:
  72
+            relative_path.append(parts.pop())
  73
+        relative_path.reverse()
  74
+        path = os.path.join(*relative_path)
  75
+        package_files = package_data.setdefault('.'.join(parts), [])
  76
+        package_files.extend([os.path.join(path, f) for f in filenames])
79 77
 
80  
-# Small hack for working with bdist_wininst.
81  
-# See http://mail.python.org/pipermail/distutils-sig/2004-August/004134.html
82  
-if len(sys.argv) > 1 and sys.argv[1] == 'bdist_wininst':
83  
-    for file_info in data_files:
84  
-        file_info[0] = '\\PURELIB\\%s' % file_info[0]
85 78
 
86 79
 # Dynamically calculate the version based on django.VERSION.
87 80
 version = __import__('django').get_version()
88 81
 
  82
+
89 83
 setup(
90  
-    name = "Django",
91  
-    version = version,
92  
-    url = 'http://www.djangoproject.com/',
93  
-    author = 'Django Software Foundation',
94  
-    author_email = 'foundation@djangoproject.com',
95  
-    description = 'A high-level Python Web framework that encourages rapid development and clean, pragmatic design.',
96  
-    license = "BSD",
97  
-    packages = packages,
98  
-    cmdclass = cmdclasses,
99  
-    data_files = data_files,
100  
-    scripts = ['django/bin/django-admin.py'],
101  
-    classifiers = [
  84
+    name='Django',
  85
+    version=version,
  86
+    url='http://www.djangoproject.com/',
  87
+    author='Django Software Foundation',
  88
+    author_email='foundation@djangoproject.com',
  89
+    description=('A high-level Python Web framework that encourages '
  90
+                 'rapid development and clean, pragmatic design.'),
  91
+    license='BSD',
  92
+    packages=packages,
  93
+    package_data=package_data,
  94
+    scripts=['django/bin/django-admin.py'],
  95
+    classifiers=[
102 96
         'Development Status :: 5 - Production/Stable',
103 97
         'Environment :: Web Environment',
104 98
         'Framework :: Django',
@@ -115,7 +109,7 @@ def fullsplit(path, result=None):
115 109
         'Topic :: Internet :: WWW/HTTP :: WSGI',
116 110
         'Topic :: Software Development :: Libraries :: Application Frameworks',
117 111
         'Topic :: Software Development :: Libraries :: Python Modules',
118  
-   ],
  112
+    ],
119 113
 )
120 114
 
121 115
 if overlay_warning:
@@ -136,4 +130,4 @@ def fullsplit(path, result=None):
136 130
 
137 131
 directory and re-install Django.
138 132
 
139  
-""" % { "existing_path": existing_path })
  133
+""" % {"existing_path": existing_path})

0 notes on commit a5becad

Please sign in to comment.
Something went wrong with that request. Please try again.