~ubuntu-branches/ubuntu/maverick/python3.1/maverick

« back to all changes in this revision

Viewing changes to debian/patches/distutils-install-layout.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-03-23 00:01:27 UTC
  • Revision ID: james.westby@ubuntu.com-20090323000127-mr2oo53y4j8vpldi
Tags: 3.1~a1+20090322-1
* Python 3.1 alpha1 release.
* Update to the trunk, 20090322.
* Update installation schemes: LP: #338395.
  - When the --prefix option is used for setup.py install, Use the
    `unix_prefix' scheme.
  - Use the `deb_system' scheme if --install-layout=deb is specified.
  - Use the the `unix_local' scheme if neither --install-layout=deb
    nor --prefix is specified.
* Use the information in /etc/lsb-release for platform.dist(). LP: #196526.
* pydoc: Fix detection of local documentation files.
* Build a shared library configured --with-pydebug. LP: #322580.
* Fix some lintian warnings.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh -e
 
2
 
 
3
# DP: distutils: Add an option --install-layout=deb, which
 
4
# DP: - installs into $prefix/dist-packages instead of $prefix/site-packages.
 
5
# DP: - doesn't encode the python version into the egg name.
 
6
 
 
7
dir=
 
8
if [ $# -eq 3 -a "$2" = '-d' ]; then
 
9
    pdir="-d $3"
 
10
    dir="$3/"
 
11
elif [ $# -ne 1 ]; then
 
12
    echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
 
13
    exit 1
 
14
fi
 
15
case "$1" in
 
16
    -patch)
 
17
        patch $pdir -f --no-backup-if-mismatch -p0 < $0
 
18
        ;;
 
19
    -unpatch)
 
20
        patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
 
21
        ;;
 
22
    *)
 
23
        echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
 
24
        exit 1
 
25
esac
 
26
exit 0
 
27
 
 
28
--- Lib/distutils/command/install.py.orig       2009-03-19 15:48:15.000000000 +0100
 
29
+++ Lib/distutils/command/install.py    2009-03-19 15:50:20.000000000 +0100
 
30
@@ -44,6 +44,20 @@
 
31
         'scripts': '$base/bin',
 
32
         'data'   : '$base',
 
33
         },
 
34
+    'unix_local': {
 
35
+        'purelib': '$base/local/lib/python$py_version_short/dist-packages',
 
36
+        'platlib': '$platbase/local/lib/python$py_version_short/dist-packages',
 
37
+        'headers': '$base/local/include/python$py_version_short/$dist_name',
 
38
+        'scripts': '$base/local/bin',
 
39
+        'data'   : '$base/local',
 
40
+        },
 
41
+    'deb_system': {
 
42
+        'purelib': '$base/lib/python$py_version_short/dist-packages',
 
43
+        'platlib': '$platbase/lib/python$py_version_short/dist-packages',
 
44
+        'headers': '$base/include/python$py_version_short/$dist_name',
 
45
+        'scripts': '$base/bin',
 
46
+        'data'   : '$base',
 
47
+        },
 
48
     'unix_home': {
 
49
         'purelib': '$base/lib/python',
 
50
         'platlib': '$base/lib/python',
 
51
@@ -165,6 +179,9 @@
 
52
 
 
53
         ('record=', None,
 
54
          "filename in which to record list of installed files"),
 
55
+
 
56
+        ('install-layout=', None,
 
57
+         "installation layout to choose (known values: deb)"),
 
58
         ]
 
59
 
 
60
     boolean_options = ['compile', 'force', 'skip-build', 'user']
 
61
@@ -179,6 +196,7 @@
 
62
         self.exec_prefix = None
 
63
         self.home = None
 
64
         self.user = 0
 
65
+        self.prefix_option = None
 
66
 
 
67
         # These select only the installation base; it's up to the user to
 
68
         # specify the installation scheme (currently, that means supplying
 
69
@@ -200,6 +218,9 @@
 
70
         self.install_userbase = USER_BASE
 
71
         self.install_usersite = USER_SITE
 
72
 
 
73
+        # enable custom installation, known values: deb
 
74
+        self.install_layout = None
 
75
+        
 
76
         self.compile = None
 
77
         self.optimize = None
 
78
 
 
79
@@ -428,6 +449,7 @@
 
80
             self.install_base = self.install_platbase = self.home
 
81
             self.select_scheme("unix_home")
 
82
         else:
 
83
+            self.prefix_option = self.prefix
 
84
             if self.prefix is None:
 
85
                 if self.exec_prefix is not None:
 
86
                     raise DistutilsOptionError(
 
87
@@ -442,7 +464,16 @@
 
88
 
 
89
             self.install_base = self.prefix
 
90
             self.install_platbase = self.exec_prefix
 
91
-            self.select_scheme("unix_prefix")
 
92
+            if self.install_layout:
 
93
+                if self.install_layout.lower() in ['deb']:
 
94
+                    self.select_scheme("deb_system")
 
95
+                else:
 
96
+                    raise DistutilsOptionError(
 
97
+                        "unknown value for --install-layout")
 
98
+            elif self.prefix_option:
 
99
+                self.select_scheme("unix_prefix")
 
100
+            else:
 
101
+                self.select_scheme("unix_local")
 
102
 
 
103
 
 
104
     def finalize_other(self):          # Windows and Mac OS for now
 
105
 
 
106
--- Lib/distutils/command/install_egg_info.py.orig      2009-03-19 13:38:18.000000000 +0100
 
107
+++ Lib/distutils/command/install_egg_info.py   2009-03-19 13:44:42.000000000 +0100
 
108
@@ -14,18 +14,37 @@
 
109
     description = "Install package's PKG-INFO metadata as an .egg-info file"
 
110
     user_options = [
 
111
         ('install-dir=', 'd', "directory to install to"),
 
112
+        ('install-layout', None, "custom installation layout"),
 
113
     ]
 
114
 
 
115
     def initialize_options(self):
 
116
         self.install_dir = None
 
117
+        self.install_layout = None
 
118
+        self.prefix_option = None
 
119
 
 
120
     def finalize_options(self):
 
121
         self.set_undefined_options('install_lib',('install_dir','install_dir'))
 
122
-        basename = "%s-%s-py%s.egg-info" % (
 
123
-            to_filename(safe_name(self.distribution.get_name())),
 
124
-            to_filename(safe_version(self.distribution.get_version())),
 
125
-            sys.version[:3]
 
126
-        )
 
127
+        self.set_undefined_options('install',('install_layout','install_layout'))
 
128
+        self.set_undefined_options('install',('prefix_option','prefix_option'))
 
129
+        if self.install_layout:
 
130
+            basename = "%s-%s.egg-info" % (
 
131
+                to_filename(safe_name(self.distribution.get_name())),
 
132
+                to_filename(safe_version(self.distribution.get_version()))
 
133
+                )
 
134
+            if not self.install_layout.lower() in ['deb']:
 
135
+                raise DistutilsOptionError(
 
136
+                    "unknown value for --install-layout")
 
137
+        elif self.prefix_option:
 
138
+            basename = "%s-%s-py%s.egg-info" % (
 
139
+                to_filename(safe_name(self.distribution.get_name())),
 
140
+                to_filename(safe_version(self.distribution.get_version())),
 
141
+                sys.version[:3]
 
142
+                )
 
143
+        else:
 
144
+            basename = "%s-%s.egg-info" % (
 
145
+                to_filename(safe_name(self.distribution.get_name())),
 
146
+                to_filename(safe_version(self.distribution.get_version()))
 
147
+                )
 
148
         self.target = os.path.join(self.install_dir, basename)
 
149
         self.outputs = [self.target]
 
150
 
 
151
--- Lib/distutils/sysconfig.py.orig     2009-03-19 10:49:48.000000000 +0100
 
152
+++ Lib/distutils/sysconfig.py  2009-03-19 10:53:18.000000000 +0100
 
153
@@ -119,7 +119,7 @@
 
154
         if standard_lib:
 
155
             return libpython
 
156
         else:
 
157
-            return os.path.join(libpython, "site-packages")
 
158
+            return os.path.join(libpython, "dist-packages")
 
159
     elif os.name == "nt":
 
160
         if standard_lib:
 
161
             return os.path.join(prefix, "Lib")