summaryrefslogtreecommitdiffstats
path: root/Lib/plat-mac
diff options
context:
space:
mode:
authorRonald Oussoren <ronaldoussoren@mac.com>2009-09-06 10:00:26 (GMT)
committerRonald Oussoren <ronaldoussoren@mac.com>2009-09-06 10:00:26 (GMT)
commit2596758cb42cb592f2e3c33ef77bc9b02c995510 (patch)
tree78f8869bfd6ec74755463b0f918d2e24d5972465 /Lib/plat-mac
parentf01697014f63e3fbe11f73afe789b6205125cb20 (diff)
downloadcpython-2596758cb42cb592f2e3c33ef77bc9b02c995510.zip
cpython-2596758cb42cb592f2e3c33ef77bc9b02c995510.tar.gz
cpython-2596758cb42cb592f2e3c33ef77bc9b02c995510.tar.bz2
Fix build issues on OSX 10.6 (issue 6802)
Diffstat (limited to 'Lib/plat-mac')
-rw-r--r--Lib/plat-mac/aepack.py6
-rw-r--r--Lib/plat-mac/applesingle.py9
-rw-r--r--Lib/plat-mac/buildtools.py21
-rw-r--r--Lib/plat-mac/macresource.py56
4 files changed, 49 insertions, 43 deletions
diff --git a/Lib/plat-mac/aepack.py b/Lib/plat-mac/aepack.py
index 3b31b04..6021283 100644
--- a/Lib/plat-mac/aepack.py
+++ b/Lib/plat-mac/aepack.py
@@ -58,7 +58,11 @@ unpacker_coercions = {
# Some python types we need in the packer:
#
AEDescType = AE.AEDescType
-FSSType = Carbon.File.FSSpecType
+try:
+ FSSType = Carbon.File.FSSpecType
+except AttributeError:
+ class FSSType:
+ pass
FSRefType = Carbon.File.FSRefType
AliasType = Carbon.File.AliasType
diff --git a/Lib/plat-mac/applesingle.py b/Lib/plat-mac/applesingle.py
index f6c605f..13962f6 100644
--- a/Lib/plat-mac/applesingle.py
+++ b/Lib/plat-mac/applesingle.py
@@ -119,8 +119,13 @@ def decode(infile, outpath, resonly=False, verbose=False):
if not hasattr(infile, 'read'):
if isinstance(infile, Carbon.File.Alias):
infile = infile.ResolveAlias()[0]
- if isinstance(infile, (Carbon.File.FSSpec, Carbon.File.FSRef)):
- infile = infile.as_pathname()
+
+ if hasattr(Carbon.File, "FSSpec"):
+ if isinstance(infile, (Carbon.File.FSSpec, Carbon.File.FSRef)):
+ infile = infile.as_pathname()
+ else:
+ if isinstance(infile, Carbon.File.FSRef):
+ infile = infile.as_pathname()
infile = open(infile, 'rb')
asfile = AppleSingle(infile, verbose=verbose)
diff --git a/Lib/plat-mac/buildtools.py b/Lib/plat-mac/buildtools.py
index 3480226..f137411 100644
--- a/Lib/plat-mac/buildtools.py
+++ b/Lib/plat-mac/buildtools.py
@@ -15,7 +15,10 @@ import Carbon.File
import MacOS
import macostools
import macresource
-import EasyDialogs
+try:
+ import EasyDialogs
+except ImportError:
+ EasyDialogs = None
import shutil
@@ -67,9 +70,13 @@ def process(template, filename, destname, copy_codefragment=0,
rsrcname=None, others=[], raw=0, progress="default", destroot=""):
if progress == "default":
- progress = EasyDialogs.ProgressBar("Processing %s..."%os.path.split(filename)[1], 120)
- progress.label("Compiling...")
- progress.inc(0)
+ if EasyDialogs is None:
+ print "Compiling %s"%(os.path.split(filename)[1],)
+ process = None
+ else:
+ progress = EasyDialogs.ProgressBar("Processing %s..."%os.path.split(filename)[1], 120)
+ progress.label("Compiling...")
+ progress.inc(0)
# check for the script name being longer than 32 chars. This may trigger a bug
# on OSX that can destroy your sourcefile.
if '#' in os.path.split(filename)[1]:
@@ -119,7 +126,11 @@ def update(template, filename, output):
if MacOS.runtimemodel == 'macho':
raise BuildError, "No updating yet for MachO applets"
if progress:
- progress = EasyDialogs.ProgressBar("Updating %s..."%os.path.split(filename)[1], 120)
+ if EasyDialogs is None:
+ print "Updating %s"%(os.path.split(filename)[1],)
+ progress = None
+ else:
+ progress = EasyDialogs.ProgressBar("Updating %s..."%os.path.split(filename)[1], 120)
else:
progress = None
if not output:
diff --git a/Lib/plat-mac/macresource.py b/Lib/plat-mac/macresource.py
index f02453b..d693c87 100644
--- a/Lib/plat-mac/macresource.py
+++ b/Lib/plat-mac/macresource.py
@@ -77,52 +77,38 @@ def need(restype, resid, filename=None, modname=None):
def open_pathname(pathname, verbose=0):
"""Open a resource file given by pathname, possibly decoding an
AppleSingle file"""
+ # No resource fork. We may be on OSX, and this may be either
+ # a data-fork based resource file or a AppleSingle file
+ # from the CVS repository.
try:
- refno = Res.FSpOpenResFile(pathname, 1)
+ refno = Res.FSOpenResourceFile(pathname, u'', 1)
except Res.Error, arg:
- if arg[0] in (-37, -39):
- # No resource fork. We may be on OSX, and this may be either
- # a data-fork based resource file or a AppleSingle file
- # from the CVS repository.
- try:
- refno = Res.FSOpenResourceFile(pathname, u'', 1)
- except Res.Error, arg:
- if arg[0] != -199:
- # -199 is "bad resource map"
- raise
- else:
- return refno
- # Finally try decoding an AppleSingle file
- pathname = _decode(pathname, verbose=verbose)
- refno = Res.FSOpenResourceFile(pathname, u'', 1)
- else:
+ if arg[0] != -199:
+ # -199 is "bad resource map"
raise
- return refno
+ else:
+ return refno
+ # Finally try decoding an AppleSingle file
+ pathname = _decode(pathname, verbose=verbose)
+ refno = Res.FSOpenResourceFile(pathname, u'', 1)
def resource_pathname(pathname, verbose=0):
"""Return the pathname for a resource file (either DF or RF based).
If the pathname given already refers to such a file simply return it,
otherwise first decode it."""
+ # No resource fork. We may be on OSX, and this may be either
+ # a data-fork based resource file or a AppleSingle file
+ # from the CVS repository.
try:
- refno = Res.FSpOpenResFile(pathname, 1)
- Res.CloseResFile(refno)
+ refno = Res.FSOpenResourceFile(pathname, u'', 1)
except Res.Error, arg:
- if arg[0] in (-37, -39):
- # No resource fork. We may be on OSX, and this may be either
- # a data-fork based resource file or a AppleSingle file
- # from the CVS repository.
- try:
- refno = Res.FSOpenResourceFile(pathname, u'', 1)
- except Res.Error, arg:
- if arg[0] != -199:
- # -199 is "bad resource map"
- raise
- else:
- return refno
- # Finally try decoding an AppleSingle file
- pathname = _decode(pathname, verbose=verbose)
- else:
+ if arg[0] != -199:
+ # -199 is "bad resource map"
raise
+ else:
+ return refno
+ # Finally try decoding an AppleSingle file
+ pathname = _decode(pathname, verbose=verbose)
return pathname
def open_error_resource():