Skip to content

Commit 8d784e3

Browse files
committed
Backport:
Fix for #1091468: DESTROOTed frameworkinstalls fail. Added a --destroot option to various tools, and do the right thing when we're doing a destroot install.
1 parent 01b53e1 commit 8d784e3

4 files changed

Lines changed: 28 additions & 11 deletions

File tree

Lib/plat-mac/buildtools.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def findtemplate(template=None):
6060
return file
6161

6262
def process(template, filename, destname, copy_codefragment=0,
63-
rsrcname=None, others=[], raw=0, progress="default"):
63+
rsrcname=None, others=[], raw=0, progress="default", destroot=""):
6464

6565
if progress == "default":
6666
progress = EasyDialogs.ProgressBar("Processing %s..."%os.path.split(filename)[1], 120)
@@ -108,7 +108,7 @@ def process(template, filename, destname, copy_codefragment=0,
108108
except os.error:
109109
pass
110110
process_common(template, progress, code, rsrcname, destname, 0,
111-
copy_codefragment, raw, others, filename)
111+
copy_codefragment, raw, others, filename, destroot)
112112

113113

114114
def update(template, filename, output):
@@ -130,10 +130,10 @@ def update(template, filename, output):
130130

131131

132132
def process_common(template, progress, code, rsrcname, destname, is_update,
133-
copy_codefragment, raw=0, others=[], filename=None):
133+
copy_codefragment, raw=0, others=[], filename=None, destroot=""):
134134
if MacOS.runtimemodel == 'macho':
135135
return process_common_macho(template, progress, code, rsrcname, destname,
136-
is_update, raw, others, filename)
136+
is_update, raw, others, filename, destroot)
137137
if others:
138138
raise BuildError, "Extra files only allowed for MachoPython applets"
139139
# Create FSSpecs for the various files
@@ -265,7 +265,7 @@ def process_common(template, progress, code, rsrcname, destname, is_update,
265265
progress.inc(0)
266266

267267
def process_common_macho(template, progress, code, rsrcname, destname, is_update,
268-
raw=0, others=[], filename=None):
268+
raw=0, others=[], filename=None, destroot=""):
269269
# Check that we have a filename
270270
if filename is None:
271271
raise BuildError, "Need source filename on MacOSX"
@@ -302,6 +302,7 @@ def process_common_macho(template, progress, code, rsrcname, destname, is_update
302302
builder.mainprogram = filename
303303
builder.builddir = destdir
304304
builder.name = shortname
305+
builder.destroot = destroot
305306
if rsrcname:
306307
realrsrcname = macresource.resource_pathname(rsrcname)
307308
builder.files.append((realrsrcname,

Lib/plat-mac/bundlebuilder.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ class BundleBuilder(Defaults):
110110

111111
# Verbosity level.
112112
verbosity = 1
113+
114+
# Destination root directory
115+
destroot = ""
113116

114117
def setup(self):
115118
# XXX rethink self.name munging, this is brittle.
@@ -445,7 +448,7 @@ def preProcess(self):
445448
execname = os.path.basename(self.executable)
446449
execpath = pathjoin(self.execdir, execname)
447450
if not self.symlink_exec:
448-
self.files.append((self.executable, execpath))
451+
self.files.append((self.destroot + self.executable, execpath))
449452
self.execpath = execpath
450453

451454
if self.mainprogram is not None:
@@ -828,7 +831,7 @@ def main(builder=None):
828831
"mainprogram=", "creator=", "nib=", "plist=", "link",
829832
"link-exec", "help", "verbose", "quiet", "argv", "standalone",
830833
"exclude=", "include=", "package=", "strip", "iconfile=",
831-
"lib=", "python=", "semi-standalone", "bundle-id=")
834+
"lib=", "python=", "semi-standalone", "bundle-id=", "destroot=")
832835

833836
try:
834837
options, args = getopt.getopt(sys.argv[1:], shortopts, longopts)
@@ -890,6 +893,8 @@ def main(builder=None):
890893
builder.includePackages.append(arg)
891894
elif opt == '--strip':
892895
builder.strip = 1
896+
elif opt == '--destroot':
897+
builder.destroot = arg
893898

894899
if len(args) != 1:
895900
usage("Must specify one command ('build', 'report' or 'help')")

Mac/OSX/Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# main Makefile. The next couple of variables are overridden on the
33
# commandline in that case.
44

5-
VERSION=2.4
5+
VERSION=2.5
66
builddir = ../..
77
srcdir = ../..
88
prefix=/Library/Frameworks/Python.framework/Versions/$(VERSION)
@@ -120,10 +120,12 @@ install_IDE:
120120
echo See Mac/OSX/README for details; \
121121
else \
122122
echo $(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \
123+
--destroot $(DESTDIR) \
123124
--python $(INSTALLED_PYTHONW) \
124125
--output $(DESTDIR)$(PYTHONAPPSDIR)/PythonIDE.app --noargv \
125126
$(srcdir)/Mac/Tools/IDE/PythonIDE.py ; \
126127
$(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \
128+
--destroot $(DESTDIR) \
127129
--python $(INSTALLED_PYTHONW) \
128130
--output $(DESTDIR)$(PYTHONAPPSDIR)/PythonIDE.app --noargv \
129131
$(srcdir)/Mac/Tools/IDE/PythonIDE.py; \
@@ -136,13 +138,15 @@ install_PackageManager:
136138
else \
137139
echo $(BUILDPYTHON) $(bundlebuilder) \
138140
--builddir $(DESTDIR)$(PYTHONAPPSDIR)/ \
141+
--destroot $(DESTDIR) \
139142
--python $(INSTALLED_PYTHONW) \
140143
--resource $(srcdir)/Mac/Tools/IDE/PythonIDE.rsrc \
141144
--mainprogram $(srcdir)/Mac/Tools/IDE/PackageManager.py \
142145
--iconfile $(srcdir)/Mac/Tools/IDE/PackageManager.icns \
143146
--creator Pimp build; \
144147
$(BUILDPYTHON) $(bundlebuilder) \
145148
--builddir $(DESTDIR)$(PYTHONAPPSDIR)/ \
149+
--destroot $(DESTDIR) \
146150
--python $(INSTALLED_PYTHONW) \
147151
--resource $(srcdir)/Mac/Tools/IDE/PythonIDE.rsrc \
148152
--mainprogram $(srcdir)/Mac/Tools/IDE/PackageManager.py \
@@ -157,11 +161,13 @@ install_IDLE:
157161
else \
158162
echo $(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \
159163
--python $(INSTALLED_PYTHONW) \
164+
--destroot $(DESTDIR) \
160165
--output $(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app \
161166
--extra $(srcdir)/Lib/idlelib \
162167
$(srcdir)/Tools/scripts/idle ; \
163168
$(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \
164169
--python $(INSTALLED_PYTHONW) \
170+
--destroot $(DESTDIR) \
165171
--output $(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app \
166172
--extra $(srcdir)/Lib/idlelib:Contents/Resources/idlelib \
167173
$(srcdir)/Tools/scripts/idle ; \
@@ -170,6 +176,7 @@ install_IDLE:
170176

171177
install_BuildApplet:
172178
$(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \
179+
--destroot $(DESTDIR) \
173180
--python $(INSTALLED_PYTHONW) \
174181
--output $(DESTDIR)$(PYTHONAPPSDIR)/BuildApplet.app \
175182
$(srcdir)/Mac/scripts/BuildApplet.py

Mac/scripts/BuildApplet.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ def buildapplet():
5353
buildtools.process(template, filename, dstfilename, 1)
5454
else:
5555

56-
SHORTOPTS = "o:r:ne:v?P"
57-
LONGOPTS=("output=", "resource=", "noargv", "extra=", "verbose", "help", "python=")
56+
SHORTOPTS = "o:r:ne:v?PR"
57+
LONGOPTS=("output=", "resource=", "noargv", "extra=", "verbose", "help", "python=", "destroot=")
5858
try:
5959
options, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS)
6060
except getopt.error:
@@ -67,6 +67,7 @@ def buildapplet():
6767
raw = 0
6868
extras = []
6969
verbose = None
70+
destroot = ''
7071
for opt, arg in options:
7172
if opt in ('-o', '--output'):
7273
dstfilename = arg
@@ -87,6 +88,8 @@ def buildapplet():
8788
verbose = Verbose()
8889
elif opt in ('-?', '--help'):
8990
usage()
91+
elif opt in ('-d', '--destroot'):
92+
destroot = arg
9093
# On OS9 always be verbose
9194
if sys.platform == 'mac' and not verbose:
9295
verbose = 'default'
@@ -97,7 +100,8 @@ def buildapplet():
97100
buildtools.update(template, filename, dstfilename)
98101
else:
99102
buildtools.process(template, filename, dstfilename, 1,
100-
rsrcname=rsrcfilename, others=extras, raw=raw, progress=verbose)
103+
rsrcname=rsrcfilename, others=extras, raw=raw,
104+
progress=verbose, destroot=destroot)
101105

102106
def usage():
103107
print "BuildApplet creates an application from a Python source file"

0 commit comments

Comments
 (0)