]> granicus.if.org Git - python/commitdiff
Merged revisions 74672 via svnmerge from
authorRonald Oussoren <ronaldoussoren@mac.com>
Sun, 6 Sep 2009 10:54:28 +0000 (10:54 +0000)
committerRonald Oussoren <ronaldoussoren@mac.com>
Sun, 6 Sep 2009 10:54:28 +0000 (10:54 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r74672 | ronald.oussoren | 2009-09-06 12:00:26 +0200 (Sun, 06 Sep 2009) | 1 line

  Fix build issues on OSX 10.6 (issue 6802)
........

Lib/plat-mac/aepack.py
Lib/plat-mac/applesingle.py
Lib/plat-mac/buildtools.py
Lib/plat-mac/macresource.py
Lib/test/test_aepack.py
Mac/scripts/BuildApplet.py
Misc/NEWS
configure.in

index 3b31b048cbf85ea4d0e5db00fb047136712e4f1c..6021283e7aa47520ea577e7b2738d2ae88177c0a 100644 (file)
@@ -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
 
index f6c605fd70cb81e2e705c3d7175d27b27be38e75..13962f6098286cb8974aa0baf318c313d628b647 100644 (file)
@@ -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)
index 3480226203da05aafaf1a6c255c0aa99269142cc..f137411184b2dfa7a897d793053677613bc7e206 100644 (file)
@@ -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:
index f02453ba1d779052a44c458d0a168a91d698671a..52e3e89952ac23eee856cde92acad0399abded89 100644 (file)
@@ -79,8 +79,8 @@ def open_pathname(pathname, verbose=0):
     AppleSingle file"""
     try:
         refno = Res.FSpOpenResFile(pathname, 1)
-    except Res.Error, arg:
-        if arg[0] in (-37, -39):
+    except (AttributeError, Res.Error), arg:
+        if isinstance(arg, AttributeError) or 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.
@@ -106,8 +106,8 @@ def resource_pathname(pathname, verbose=0):
     try:
         refno = Res.FSpOpenResFile(pathname, 1)
         Res.CloseResFile(refno)
-    except Res.Error, arg:
-        if arg[0] in (-37, -39):
+    except (AttributeError, Res.Error), arg:
+        if instance(arg, AttributeError), or 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.
index 8a4b035f05cf327ef7a972699863699d43ed337b..c44f1ef48110d421ffa2fa304fc5fc41e83052cc 100755 (executable)
@@ -59,6 +59,9 @@ class TestAepack(unittest.TestCase):
             import Carbon.File
         except:
             return
+
+        if not hasattr(Carbon.File, "FSSpec"):
+            return
         o = Carbon.File.FSSpec(os.curdir)
         packed = aepack.pack(o)
         unpacked = aepack.unpack(packed)
@@ -69,6 +72,8 @@ class TestAepack(unittest.TestCase):
             import Carbon.File
         except:
             return
+        if not hasattr(Carbon.File, "FSSpec"):
+            return
         o = Carbon.File.FSSpec(os.curdir).NewAliasMinimal()
         packed = aepack.pack(o)
         unpacked = aepack.unpack(packed)
index e71ebc1261f0731715adc60535752c32f5a3175d..eeeb82bfd7c14895702a53fd5ec5de5eeef602ab 100644 (file)
@@ -12,7 +12,10 @@ sys.stdout = sys.stderr
 
 import os
 import MacOS
-import EasyDialogs
+try:
+    import EasyDialogs
+except ImportError:
+    EasyDialogs = None
 import buildtools
 import getopt
 
@@ -32,7 +35,10 @@ def main():
     try:
         buildapplet()
     except buildtools.BuildError, detail:
-        EasyDialogs.Message(detail)
+        if EasyDialogs is None:
+            print detail
+        else:
+            EasyDialogs.Message(detail)
 
 
 def buildapplet():
@@ -46,6 +52,10 @@ def buildapplet():
     # Ask for source text if not specified in sys.argv[1:]
 
     if not sys.argv[1:]:
+        if EasyDialogs is None:
+            usage()
+            sys.exit(1)
+
         filename = EasyDialogs.AskFileForOpen(message='Select Python source or applet:',
                 typeList=('TEXT', 'APPL'))
         if not filename:
index afaa55b0963f6001b7873a6edaa83651abdaf79c..a41f38cdbe417aa9a60e029710793f52f5004805 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -185,6 +185,8 @@ Extension Modules
 Build
 -----
 
+- Issue #6802: Fix build issues on MacOSX 10.6
+
 - Issue 5390: Add uninstall icon independent of whether file
   extensions are installed.
 
index f9c1139508d0973608e641b34af28241765d3721..ecfe4e7b95d430c2c70eb07ca149f2178bb427e9 100644 (file)
@@ -92,7 +92,6 @@ AC_ARG_ENABLE(universalsdk,
 ])
 AC_SUBST(UNIVERSALSDK)
 
-ARCH_RUN_32BIT=
 AC_SUBST(ARCH_RUN_32BIT)
 
 UNIVERSAL_ARCHS="32-bit"
@@ -921,6 +920,7 @@ yes)
 
                 elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then
                   UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64"
+                  ARCH_RUN_32BIT="true"
 
                 elif test "$UNIVERSAL_ARCHS" = "all" ; then
                   UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64"
@@ -944,12 +944,22 @@ yes)
            cur_target=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
            if test ${cur_target} '>' 10.2; then
                    cur_target=10.3
-           fi
-           if test "${UNIVERSAL_ARCHS}" = "all"; then
-                   # Ensure that the default platform for a 4-way
-                   # universal build is OSX 10.5, that's the first
-                   # OS release where 4-way builds make sense.
-                   cur_target='10.5'
+                   if test ${enable_universalsdk}; then
+                           if test "${UNIVERSAL_ARCHS}" = "all"; then
+                                   # Ensure that the default platform for a 
+                                   # 4-way universal build is OSX 10.5, 
+                                   # that's the first OS release where 
+                                   # 4-way builds make sense.
+                                   cur_target='10.5'
+                           fi
+                   else
+                           if test `arch` = "i386"; then
+                                   # On Intel macs default to a deployment
+                                   # target of 10.4, that's the first OSX
+                                   # release with Intel support.
+                                   cur_target="10.4"
+                           fi
+                   fi
            fi
            CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
            
@@ -1519,6 +1529,8 @@ case $ac_sys_system/$ac_sys_release in
     ;;
 esac
 
+
+ARCH_RUN_32BIT=""
 AC_SUBST(LIBTOOL_CRUFT)
 case $ac_sys_system/$ac_sys_release in
   Darwin/@<:@01567@:>@\..*) 
@@ -1526,7 +1538,7 @@ case $ac_sys_system/$ac_sys_release in
     if test "${enable_universalsdk}"; then
            :
     else
-       LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `arch`"
+        LIBTOOL_CRUFT="${LIBTOOL_CRUFT} -arch_only `arch`"
     fi
     LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
     LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
@@ -1538,7 +1550,48 @@ case $ac_sys_system/$ac_sys_release in
         else 
             LIBTOOL_CRUFT=""
     fi
-    LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only `arch`"
+    AC_TRY_RUN([[
+    #include <unistd.h>
+    int main(int argc, char*argv[])
+    {
+      if (sizeof(long) == 4) {
+         return 0;
+      } else {
+         return 1;
+      }
+    ]], ac_osx_32bit=yes,
+       ac_osx_32bit=no,
+       ac_osx_32bit=no)
+    
+    if test "${ac_osx_32bit}" = "yes"; then
+       case `arch` in
+       i386) 
+               MACOSX_DEFAULT_ARCH="i386" 
+               ;;
+       ppc) 
+               MACOSX_DEFAULT_ARCH="ppc" 
+               ;;
+       *)
+               AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
+               ;;
+       esac
+    else
+       case `arch` in
+       i386) 
+               MACOSX_DEFAULT_ARCH="x86_64" 
+               ;;
+       ppc) 
+               MACOSX_DEFAULT_ARCH="ppc64" 
+               ;;
+       *)
+               AC_MSG_ERROR([Unexpected output of 'arch' on OSX])
+               ;;
+       esac
+
+       #ARCH_RUN_32BIT="true"
+    fi
+
+    LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only ${MACOSX_DEFAULT_ARCH}"
     LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
     LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
 esac