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.
8
if [ $# -eq 3 -a "$2" = '-d' ]; then
11
elif [ $# -ne 1 ]; then
12
echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
17
patch $pdir -f --no-backup-if-mismatch -p0 < $0
20
patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
23
echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
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
31
'scripts': '$base/bin',
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',
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',
49
'purelib': '$base/lib/python',
50
'platlib': '$base/lib/python',
54
"filename in which to record list of installed files"),
56
+ ('install-layout=', None,
57
+ "installation layout to choose (known values: deb)"),
60
boolean_options = ['compile', 'force', 'skip-build', 'user']
62
self.exec_prefix = None
65
+ self.prefix_option = None
67
# These select only the installation base; it's up to the user to
68
# specify the installation scheme (currently, that means supplying
70
self.install_userbase = USER_BASE
71
self.install_usersite = USER_SITE
73
+ # enable custom installation, known values: deb
74
+ self.install_layout = None
80
self.install_base = self.install_platbase = self.home
81
self.select_scheme("unix_home")
83
+ self.prefix_option = self.prefix
84
if self.prefix is None:
85
if self.exec_prefix is not None:
86
raise DistutilsOptionError(
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")
96
+ raise DistutilsOptionError(
97
+ "unknown value for --install-layout")
98
+ elif self.prefix_option:
99
+ self.select_scheme("unix_prefix")
101
+ self.select_scheme("unix_local")
104
def finalize_other(self): # Windows and Mac OS for now
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
109
description = "Install package's PKG-INFO metadata as an .egg-info file"
111
('install-dir=', 'd', "directory to install to"),
112
+ ('install-layout', None, "custom installation layout"),
115
def initialize_options(self):
116
self.install_dir = None
117
+ self.install_layout = None
118
+ self.prefix_option = None
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())),
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()))
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())),
144
+ basename = "%s-%s.egg-info" % (
145
+ to_filename(safe_name(self.distribution.get_name())),
146
+ to_filename(safe_version(self.distribution.get_version()))
148
self.target = os.path.join(self.install_dir, basename)
149
self.outputs = [self.target]
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
157
- return os.path.join(libpython, "site-packages")
158
+ return os.path.join(libpython, "dist-packages")
159
elif os.name == "nt":
161
return os.path.join(prefix, "Lib")