Got rid of the python.rsrc resource file. The error message strings and
dialogs are now stored in Mac/Lib, and loaded on demand through macresource.
Not only does this simplify a MacPython based on Apple's Python, but
it also makes Mac error codes come out symbolically when running command
line python (if you have Mac/Lib in your path).
The resource files are copied from Mac/Resources. The old ones will disappear
after the OS9 build procedure has been adjusted.
diff --git a/Mac/Lib/buildtools.py b/Mac/Lib/buildtools.py
index a02c609..163f19a 100644
--- a/Mac/Lib/buildtools.py
+++ b/Mac/Lib/buildtools.py
@@ -353,58 +353,31 @@
ofp.close()
- if progress:
- progress.label("Copy resources...")
- progress.set(20)
- resfilename = 'python.rsrc' # XXXX later: '%s.rsrc' % shortname
- try:
- output = Res.FSOpenResourceFile(
- os.path.join(destname, 'Contents', 'Resources', resfilename),
- u'', WRITE)
- except MacOS.Error:
- fsr, dummy = Res.FSCreateResourceFile(
- os.path.join(destname, 'Contents', 'Resources'),
- unicode(resfilename), '')
- output = Res.FSOpenResourceFile(fsr, u'', WRITE)
-
# Copy the resources from the target specific resource template, if any
typesfound, ownertype = [], None
try:
input = macresource.open_pathname(rsrcname)
except (MacOS.Error, ValueError):
- pass
if progress:
progress.inc(50)
else:
+ if progress:
+ progress.label("Copy resources...")
+ progress.set(20)
+ resfilename = 'python.rsrc' # XXXX later: '%s.rsrc' % shortname
+ try:
+ output = Res.FSOpenResourceFile(
+ os.path.join(destname, 'Contents', 'Resources', resfilename),
+ u'', WRITE)
+ except MacOS.Error:
+ fsr, dummy = Res.FSCreateResourceFile(
+ os.path.join(destname, 'Contents', 'Resources'),
+ unicode(resfilename), '')
+ output = Res.FSOpenResourceFile(fsr, u'', WRITE)
+
typesfound, ownertype = copyres(input, output, [], 0, progress)
Res.CloseResFile(input)
-
- # Check which resource-types we should not copy from the template
- skiptypes = []
-## if 'vers' in typesfound: skiptypes.append('vers')
-## if 'SIZE' in typesfound: skiptypes.append('SIZE')
-## if 'BNDL' in typesfound: skiptypes = skiptypes + ['BNDL', 'FREF', 'icl4',
-## 'icl8', 'ics4', 'ics8', 'ICN#', 'ics#']
-## if not copy_codefragment:
-## skiptypes.append('cfrg')
-## skipowner = (ownertype <> None)
-
- # Copy the resources from the template
-
- input = Res.FSOpenResourceFile(
- os.path.join(template, 'Contents', 'Resources', 'python.rsrc'), u'', READ)
- if progress:
- progress.label("Copy standard resources...")
- progress.inc(0)
-## dummy, tmplowner = copyres(input, output, skiptypes, 1, progress)
- dummy, tmplowner = copyres(input, output, skiptypes, 1, None)
-
- Res.CloseResFile(input)
-## if ownertype == None:
-## raise BuildError, "No owner resource found in either resource file or template"
- # Make sure we're manipulating the output resource file now
-
- Res.CloseResFile(output)
+ Res.CloseResFile(output)
if code:
if raw: