diff options
Diffstat (limited to 'Mac')
-rwxr-xr-x | Mac/BuildScript/build-installer.py | 2 | ||||
-rw-r--r-- | Mac/BuildScript/resources/ReadMe.txt | 2 | ||||
-rw-r--r-- | Mac/IDLE/Makefile.in | 3 | ||||
-rw-r--r-- | Mac/Makefile.in | 10 | ||||
-rw-r--r-- | Mac/PythonLauncher/Makefile.in | 3 | ||||
-rwxr-xr-x | Mac/PythonLauncher/MyDocument.m | 4 | ||||
-rw-r--r-- | Mac/PythonLauncher/doscript.m | 141 | ||||
-rw-r--r-- | Mac/Resources/app/Info.plist.in (renamed from Mac/Resources/app/Info.plist) | 10 | ||||
-rw-r--r-- | Mac/Resources/app/Resources/English.lproj/InfoPlist.strings | bin | 656 -> 0 bytes | |||
-rw-r--r-- | Mac/Resources/framework/English.lproj/InfoPlist.strings | bin | 358 -> 0 bytes | |||
-rw-r--r-- | Mac/Resources/framework/Info.plist.in (renamed from Mac/Resources/framework/Info.plist) | 8 | ||||
-rw-r--r-- | Mac/Resources/framework/version.plist | 18 |
12 files changed, 65 insertions, 136 deletions
diff --git a/Mac/BuildScript/build-installer.py b/Mac/BuildScript/build-installer.py index 6cf9c21..8e359ba 100755 --- a/Mac/BuildScript/build-installer.py +++ b/Mac/BuildScript/build-installer.py @@ -199,7 +199,7 @@ PKG_RECIPES = [ dict( name="PythonApplications", long_name="GUI Applications", - source="/Applications/MacPython %(VER)s", + source="/Applications/Python %(VER)s", readme="""\ This package installs IDLE (an interactive Python IDE), Python Launcher and Build Applet (create application bundles diff --git a/Mac/BuildScript/resources/ReadMe.txt b/Mac/BuildScript/resources/ReadMe.txt index 1a6e637..cb00c93 100644 --- a/Mac/BuildScript/resources/ReadMe.txt +++ b/Mac/BuildScript/resources/ReadMe.txt @@ -19,7 +19,7 @@ environment, an applet builder), plus a set of pre-built extension modules that open up specific Macintosh technologies to Python programs (Carbon, AppleScript, Quicktime, more). -The installer puts the applications in "MacPython $VERSION" +The installer puts the applications in "Python $VERSION" in your Applications folder, command-line tools in /usr/local/bin and the underlying machinery in $PYTHONFRAMEWORKINSTALLDIR. diff --git a/Mac/IDLE/Makefile.in b/Mac/IDLE/Makefile.in index da6922e..35f739d 100644 --- a/Mac/IDLE/Makefile.in +++ b/Mac/IDLE/Makefile.in @@ -9,6 +9,7 @@ srcdir= @srcdir@ VERSION= @VERSION@ UNIVERSALSDK=@UNIVERSALSDK@ builddir= ../.. +PYTHONFRAMEWORK=@PYTHONFRAMEWORK@ RUNSHARED= @RUNSHARED@ BUILDEXE= @BUILDEXEEXT@ @@ -21,7 +22,7 @@ MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@ BUNDLEBULDER=$(srcdir)/../../Lib/plat-mac/bundlebuilder.py -PYTHONAPPSDIR=/Applications/MacPython $(VERSION) +PYTHONAPPSDIR=/Applications/$(PYTHONFRAMEWORK) $(VERSION) all: IDLE.app diff --git a/Mac/Makefile.in b/Mac/Makefile.in index 8b2e1db..34734d0 100644 --- a/Mac/Makefile.in +++ b/Mac/Makefile.in @@ -13,14 +13,16 @@ BUILDPYTHON=$(builddir)/python$(BUILDEXE) DESTDIR= LDFLAGS=@LDFLAGS@ FRAMEWORKUNIXTOOLSPREFIX=@FRAMEWORKUNIXTOOLSPREFIX@ +PYTHONFRAMEWORK=@PYTHONFRAMEWORK@ + # These are normally glimpsed from the previous set bindir=$(prefix)/bin -PYTHONAPPSDIR=/Applications/MacPython $(VERSION) +PYTHONAPPSDIR=/Applications/$(PYTHONFRAMEWORK) $(VERSION) APPINSTALLDIR=$(prefix)/Resources/Python.app # Variables for installing the "normal" unix binaries -INSTALLED_PYTHONAPP=$(APPINSTALLDIR)/Contents/MacOS/Python +INSTALLED_PYTHONAPP=$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK) # Items more-or-less copied from the main Makefile DIRMODE=755 @@ -103,7 +105,7 @@ install_versionedtools: pythonw: $(srcdir)/Tools/pythonw.c Makefile $(CC) $(LDFLAGS) -o $@ $(srcdir)/Tools/pythonw.c \ - -DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/Python"' + -DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"' install_PythonLauncher: @@ -155,7 +157,7 @@ install_Python: esac; \ done; \ done - $(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/Python" + $(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)" install_IDLE: cd IDLE && make install diff --git a/Mac/PythonLauncher/Makefile.in b/Mac/PythonLauncher/Makefile.in index f27e21e..4a864f32 100644 --- a/Mac/PythonLauncher/Makefile.in +++ b/Mac/PythonLauncher/Makefile.in @@ -12,6 +12,7 @@ builddir= ../.. RUNSHARED= @RUNSHARED@ BUILDEXE= @BUILDEXEEXT@ BUILDPYTHON= $(builddir)/python$(BUILDEXE) +PYTHONFRAMEWORK=@PYTHONFRAMEWORK@ # Deployment target selected during configure, to be checked # by distutils @@ -20,7 +21,7 @@ MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@ BUNDLEBULDER=$(srcdir)/../../Lib/plat-mac/bundlebuilder.py -PYTHONAPPSDIR=/Applications/MacPython $(VERSION) +PYTHONAPPSDIR=/Applications/$(PYTHONFRAMEWORK) $(VERSION) OBJECTS=FileSettings.o MyAppDelegate.o MyDocument.o PreferencesWindowController.o doscript.o main.o all: Python\ Launcher.app diff --git a/Mac/PythonLauncher/MyDocument.m b/Mac/PythonLauncher/MyDocument.m index 5acc2dc..86112c4 100755 --- a/Mac/PythonLauncher/MyDocument.m +++ b/Mac/PythonLauncher/MyDocument.m @@ -121,8 +121,8 @@ return YES; } else { [self run]; - [self close]; - return NO; + [self performSelector:@selector(close) withObject:nil afterDelay:0.0]; + return YES; } } diff --git a/Mac/PythonLauncher/doscript.m b/Mac/PythonLauncher/doscript.m index 3e4e223..024b883 100644 --- a/Mac/PythonLauncher/doscript.m +++ b/Mac/PythonLauncher/doscript.m @@ -11,108 +11,49 @@ #import <ApplicationServices/ApplicationServices.h> #import "doscript.h" -/* I assume I could pick these up from somewhere, but where... */ -#define CREATOR 'trmx' - -#define ACTIVATE_CMD 'misc' -#define ACTIVATE_SUITE 'actv' - -#define DOSCRIPT_CMD 'dosc' -#define DOSCRIPT_SUITE 'core' -#define WITHCOMMAND 'cmnd' - -/* ... and there's probably also a better way to do this... */ -#define START_TERMINAL "/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal &" - extern int doscript(const char *command) { - OSErr err; - AppleEvent theAEvent, theReply; - AEAddressDesc terminalAddress; - AEDesc commandDesc; - OSType terminalCreator = CREATOR; - - /* set up locals */ - AECreateDesc(typeNull, NULL, 0, &theAEvent); - AECreateDesc(typeNull, NULL, 0, &terminalAddress); - AECreateDesc(typeNull, NULL, 0, &theReply); - AECreateDesc(typeNull, NULL, 0, &commandDesc); - - /* create the "activate" event for Terminal */ - err = AECreateDesc(typeApplSignature, (Ptr) &terminalCreator, - sizeof(terminalCreator), &terminalAddress); - if (err != noErr) { - NSLog(@"doscript: AECreateDesc: error %d\n", err); - goto bail; - } - err = AECreateAppleEvent(ACTIVATE_SUITE, ACTIVATE_CMD, - &terminalAddress, kAutoGenerateReturnID, - kAnyTransactionID, &theAEvent); - - if (err != noErr) { - NSLog(@"doscript: AECreateAppleEvent(activate): error %d\n", err); - goto bail; - } - /* send the event */ - err = AESend(&theAEvent, &theReply, kAEWaitReply, - kAENormalPriority, kAEDefaultTimeout, NULL, NULL); - if ( err == -600 ) { - int count=10; - /* If it failed with "no such process" try to start Terminal */ - err = system(START_TERMINAL); - if ( err ) { - NSLog(@"doscript: system(): %s\n", strerror(errno)); - goto bail; - } - do { - sleep(1); - /* send the event again */ - err = AESend(&theAEvent, &theReply, kAEWaitReply, - kAENormalPriority, kAEDefaultTimeout, NULL, NULL); - } while (err == -600 && --count > 0); - if ( err == -600 ) - NSLog(@"doscript: Could not activate Terminal\n"); - } - if (err != noErr) { - NSLog(@"doscript: AESend(activate): error %d\n", err); - goto bail; - } - - /* create the "doscript with command" event for Terminal */ - err = AECreateAppleEvent(DOSCRIPT_SUITE, DOSCRIPT_CMD, - &terminalAddress, kAutoGenerateReturnID, - kAnyTransactionID, &theAEvent); - if (err != noErr) { - NSLog(@"doscript: AECreateAppleEvent(doscript): error %d\n", err); - goto bail; - } - - /* add the command to the apple event */ - err = AECreateDesc(typeChar, command, strlen(command), &commandDesc); - if (err != noErr) { - NSLog(@"doscript: AECreateDesc(command): error %d\n", err); - goto bail; - } - err = AEPutParamDesc(&theAEvent, WITHCOMMAND, &commandDesc); - if (err != noErr) { - NSLog(@"doscript: AEPutParamDesc: error %d\n", err); - goto bail; - } + char *bundleID = "com.apple.Terminal"; + AppleEvent evt, res; + AEDesc desc; + OSStatus err; + + [[NSWorkspace sharedWorkspace] launchApplication:@"/Applications/Utilities/Terminal.app/"]; + + // Build event + err = AEBuildAppleEvent(kAECoreSuite, kAEDoScript, + typeApplicationBundleID, + bundleID, strlen(bundleID), + kAutoGenerateReturnID, + kAnyTransactionID, + &evt, NULL, + "'----':utf8(@)", strlen(command), + command); + if (err) { + NSLog(@"AEBuildAppleEvent failed: %d\n", err); + return err; + } + + // Send event and check for any Apple Event Manager errors + err = AESendMessage(&evt, &res, kAEWaitReply, kAEDefaultTimeout); + AEDisposeDesc(&evt); + if (err) { + NSLog(@"AESendMessage failed: %d\n", err); + return err; + } + // Check for any application errors + err = AEGetParamDesc(&res, keyErrorNumber, typeSInt32, &desc); + AEDisposeDesc(&res); + if (!err) { + AEGetDescData(&desc, &err, sizeof(err)); + NSLog(@"Terminal returned an error: %d", err); + AEDisposeDesc(&desc); + } else if (err == errAEDescNotFound) { + err = noErr; + } else { + NSLog(@"AEGetPArmDesc returned an error: %d", err); + } - /* send the command event to Terminal.app */ - err = AESend(&theAEvent, &theReply, kAEWaitReply, - kAENormalPriority, kAEDefaultTimeout, NULL, NULL); - - if (err != noErr) { - NSLog(@"doscript: AESend(docommand): error %d\n", err); - goto bail; - } - /* clean up and leave */ -bail: - AEDisposeDesc(&commandDesc); - AEDisposeDesc(&theAEvent); - AEDisposeDesc(&terminalAddress); - AEDisposeDesc(&theReply); - return err; + return err; } diff --git a/Mac/Resources/app/Info.plist b/Mac/Resources/app/Info.plist.in index 387bbed..1233715 100644 --- a/Mac/Resources/app/Info.plist +++ b/Mac/Resources/app/Info.plist.in @@ -20,7 +20,7 @@ <key>CFBundleExecutable</key> <string>Python</string> <key>CFBundleGetInfoString</key> - <string>2.5alpha0, (c) 2004 Python Software Foundation.</string> + <string>@VERSION@, (c) 2004 Python Software Foundation.</string> <key>CFBundleHelpBookFolder</key> <array> <string>Documentation</string> @@ -33,21 +33,21 @@ <key>CFBundleIconFile</key> <string>PythonInterpreter.icns</string> <key>CFBundleIdentifier</key> - <string>org.python.python</string> + <string>@PYTHONFRAMEWORKIDENTIFIER@.app</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleLongVersionString</key> - <string>2.5alpha0, (c) 2004 Python Software Foundation.</string> + <string>@VERSION@, (c) 2004-2008 Python Software Foundation.</string> <key>CFBundleName</key> <string>Python</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> - <string>2.5alpha0</string> + <string>@VERSION@</string> <key>CFBundleSignature</key> <string>PytX</string> <key>CFBundleVersion</key> - <string>2.5alpha0</string> + <string>@VERSION@</string> <key>CSResourcesFileMapped</key> <true/> <key>LSRequiresCarbon</key> diff --git a/Mac/Resources/app/Resources/English.lproj/InfoPlist.strings b/Mac/Resources/app/Resources/English.lproj/InfoPlist.strings Binary files differdeleted file mode 100644 index f8a8bc1..0000000 --- a/Mac/Resources/app/Resources/English.lproj/InfoPlist.strings +++ /dev/null diff --git a/Mac/Resources/framework/English.lproj/InfoPlist.strings b/Mac/Resources/framework/English.lproj/InfoPlist.strings Binary files differdeleted file mode 100644 index cc24bfc..0000000 --- a/Mac/Resources/framework/English.lproj/InfoPlist.strings +++ /dev/null diff --git a/Mac/Resources/framework/Info.plist b/Mac/Resources/framework/Info.plist.in index 302ff48..a753e88 100644 --- a/Mac/Resources/framework/Info.plist +++ b/Mac/Resources/framework/Info.plist.in @@ -9,7 +9,7 @@ <key>CFBundleGetInfoString</key> <string>Python Runtime and Library</string> <key>CFBundleIdentifier</key> - <string>org.python.python</string> + <string>@PYTHONFRAMEWORKIDENTIFIER@</string> <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> @@ -17,10 +17,12 @@ <key>CFBundlePackageType</key> <string>FMWK</string> <key>CFBundleShortVersionString</key> - <string>2.5</string> + <string>%VERSION%, (c) 2004-2008 Python Software Foundation.</string> + <key>CFBundleLongVersionString</key> + <string>%VERSION%, (c) 2004-2008 Python Software Foundation.</string> <key>CFBundleSignature</key> <string>????</string> <key>CFBundleVersion</key> - <string>2.5</string> + <string>%VERSION%</string> </dict> </plist> diff --git a/Mac/Resources/framework/version.plist b/Mac/Resources/framework/version.plist deleted file mode 100644 index 7527442..0000000 --- a/Mac/Resources/framework/version.plist +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>BuildVersion</key> - <string>1</string> - <key>CFBundleShortVersionString</key> - <string>2.5alpha0</string> - <key>CFBundleVersion</key> - <string>2.5alpha0</string> - <key>ProjectName</key> - <string>Python</string> - <key>ReleaseStatus</key> - <string>alfa</string> - <key>SourceVersion</key> - <string>2.4a0</string> -</dict> -</plist> |