Skip to content

Commit d5d9279

Browse files
author
mtredinnick
committed
Fixed #3338, #3536, #3796 -- Fixed a bunch of setup and build problems in a
portable fashion. That took a *lot* longer to debug than I thought it would, so let's try not to break it. git-svn-id: http://code.djangoproject.com/svn/django/trunk@4912 bcc190cf-cafb-0310-a4f2-bffc1f526a37
1 parent c7d88fa commit d5d9279

File tree

4 files changed

+39
-16
lines changed

4 files changed

+39
-16
lines changed

MANIFEST.in

+4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
include README
12
include AUTHORS
23
include INSTALL
34
include LICENSE
5+
include MANIFEST.in
46
recursive-include docs *
57
recursive-include scripts *
8+
recursive-include examples *
9+
recursive-include extras *
610
recursive-include django/conf/locale *
711
recursive-include django/contrib/admin/templates *
812
recursive-include django/contrib/admin/media *

scripts/rpm-install.sh

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
#! /bin/sh
22
#
3-
# this file is *inserted* into the install section of the generated
4-
# spec file
3+
# This file becomes the install section of the generated spec file.
54
#
65

7-
# this is, what dist.py normally does
6+
# This is what dist.py normally does.
87
python setup.py install --root=${RPM_BUILD_ROOT} --record="INSTALLED_FILES"
98

9+
# Sort the filelist so that directories appear before files. This avoids
10+
# duplicate filename problems on some systems.
11+
touch DIRS
1012
for i in `cat INSTALLED_FILES`; do
1113
if [ -f ${RPM_BUILD_ROOT}/$i ]; then
1214
echo $i >>FILES
@@ -16,4 +18,6 @@ for i in `cat INSTALLED_FILES`; do
1618
fi
1719
done
1820

19-
cat DIRS FILES >INSTALLED_FILES
21+
# Make sure we match foo.pyo and foo.pyc along with foo.py (but only once each)
22+
sed -e "/\.py[co]$/d" -e "s/\.py$/.py*/" DIRS FILES >INSTALLED_FILES
23+

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[bdist_rpm]
2-
doc_files = docs/*.txt
2+
doc_files = docs examples extras AUTHORS INSTALL LICENSE README
33
install-script = scripts/rpm-install.sh
44

setup.py

+26-11
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,20 @@
33
import os
44
import sys
55

6+
def fullsplit(path, result=None):
7+
"""
8+
Split a pathname into components (the opposite of os.path.join) in a
9+
platform-neutral way.
10+
"""
11+
if result is None:
12+
result = []
13+
head, tail = os.path.split(path)
14+
if head == '':
15+
return [tail] + result
16+
if head == path:
17+
return result
18+
return fullsplit(head, [tail] + result)
19+
620
# Tell distutils to put the data_files in platform-specific installation
721
# locations. See here for an explanation:
822
# http://groups.google.com/group/comp.lang.python/browse_thread/thread/35ec7b2fed36eaec/2105ee4d9e8042cb
@@ -13,27 +27,28 @@
1327
# an easy way to do this.
1428
packages, data_files = [], []
1529
root_dir = os.path.dirname(__file__)
16-
len_root_dir = len(root_dir)
1730
django_dir = os.path.join(root_dir, 'django')
31+
pieces = fullsplit(root_dir)
32+
if pieces[-1] == '':
33+
len_root_dir = len(pieces)- 1
34+
else:
35+
len_root_dir = len(pieces)
1836

1937
for dirpath, dirnames, filenames in os.walk(django_dir):
2038
# Ignore dirnames that start with '.'
2139
for i, dirname in enumerate(dirnames):
2240
if dirname.startswith('.'): del dirnames[i]
2341
if '__init__.py' in filenames:
24-
package = dirpath[len_root_dir:].lstrip('/').replace('/', '.')
25-
packages.append(package)
26-
else:
42+
packages.append('.'.join(fullsplit(dirpath)[len_root_dir:]))
43+
elif filenames:
2744
data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]])
2845

29-
# Small hack for working with bdist_wininst.
30-
# See http://mail.python.org/pipermail/distutils-sig/2004-August/004134.html
31-
if len(sys.argv) > 1 and sys.argv[1] == 'bdist_wininst':
32-
for file_info in data_files:
33-
file_info[0] = '/PURELIB/%s' % file_info[0]
34-
3546
# Dynamically calculate the version based on django.VERSION.
36-
version = "%d.%d-%s" % (__import__('django').VERSION)
47+
version_tuple = __import__('django').VERSION
48+
if version_tuple[2] is not None:
49+
version = "%d.%d_%s" % version_tuple
50+
else:
51+
version = "%d.%d" % version_tuple[:2]
3752

3853
setup(
3954
name = "Django",

0 commit comments

Comments
 (0)