diff options
| author | Ronald Oussoren <ronaldoussoren@mac.com> | 2006-10-08 17:41:25 +0000 |
|---|---|---|
| committer | Ronald Oussoren <ronaldoussoren@mac.com> | 2006-10-08 17:41:25 +0000 |
| commit | 392cafba4fb899f8a205f7962302b77db8c61980 (patch) | |
| tree | 74ec202946b517aac1a4bbcccdd1eac9b6223f8b /Mac/OSX | |
| parent | 16ca35a2a59712400b1326166f26a689b646e6bb (diff) | |
| download | cpython-git-392cafba4fb899f8a205f7962302b77db8c61980.tar.gz | |
Port of universal binary support for Mac OSX from python 2.5. This takes away
the need for the out-of-tree universal binary support that was used to build
the 2.4.3 installer.
Missing here relative to that tree are some changes to IDLE, IMHO those patches
aren't appropriate for the 2.4 branch and users are better of using 2.5's IDLE.
Diffstat (limited to 'Mac/OSX')
| -rw-r--r-- | Mac/OSX/Extras.install.py | 1 | ||||
| -rw-r--r-- | Mac/OSX/IDLE/IDLE.icns | bin | 0 -> 53456 bytes | |||
| -rw-r--r-- | Mac/OSX/IDLE/Info.plist | 26 | ||||
| -rw-r--r-- | Mac/OSX/IDLE/Makefile.in | 49 | ||||
| -rw-r--r-- | Mac/OSX/IDLE/idlemain.py | 27 | ||||
| -rw-r--r-- | Mac/OSX/Makefile | 273 | ||||
| -rw-r--r-- | Mac/OSX/Makefile.in | 294 | ||||
| -rwxr-xr-x | Mac/OSX/PythonLauncher/FileSettings.m | 25 | ||||
| -rw-r--r-- | Mac/OSX/PythonLauncher/Info.plist | 65 | ||||
| -rw-r--r-- | Mac/OSX/PythonLauncher/Makefile.in | 81 | ||||
| -rw-r--r-- | Mac/OSX/PythonLauncher/PythonCompiled.icns | bin | 57125 -> 60777 bytes | |||
| -rw-r--r-- | Mac/OSX/PythonLauncher/PythonInterpreter.icns | bin | 45913 -> 42658 bytes | |||
| -rw-r--r-- | Mac/OSX/PythonLauncher/PythonSource.icns | bin | 50112 -> 54522 bytes | |||
| -rw-r--r-- | Mac/OSX/PythonLauncher/PythonWSource.icns | bin | 49891 -> 54522 bytes | |||
| -rw-r--r-- | Mac/OSX/fixapplepython23.py | 14 | ||||
| -rw-r--r-- | Mac/OSX/pythonw.c | 17 |
16 files changed, 593 insertions, 279 deletions
diff --git a/Mac/OSX/Extras.install.py b/Mac/OSX/Extras.install.py index 2521f06a65..b68d3e7b7c 100644 --- a/Mac/OSX/Extras.install.py +++ b/Mac/OSX/Extras.install.py @@ -9,6 +9,7 @@ verbose = 1 debug = 0 def isclean(name): + if name == '.svn': return 0 if name == 'CVS': return 0 if name == '.cvsignore': return 0 if name == '.DS_store': return 0 diff --git a/Mac/OSX/IDLE/IDLE.icns b/Mac/OSX/IDLE/IDLE.icns Binary files differnew file mode 100644 index 0000000000..c12c9da52a --- /dev/null +++ b/Mac/OSX/IDLE/IDLE.icns diff --git a/Mac/OSX/IDLE/Info.plist b/Mac/OSX/IDLE/Info.plist new file mode 100644 index 0000000000..b475b1b075 --- /dev/null +++ b/Mac/OSX/IDLE/Info.plist @@ -0,0 +1,26 @@ +<?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>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleExecutable</key> + <string>IDLE</string> + <key>CFBundleGetInfoString</key> + <string>2.5, © 001-2006 Python Software Foundation</string> + <key>CFBundleIconFile</key> + <string>PythonApplet.icns</string> + <key>CFBundleIdentifier</key> + <string>org.python.IDLE</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>IDLE</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleShortVersionString</key> + <string>2.5</string> + <key>CFBundleVersion</key> + <string>2.5</string> +</dict> +</plist> diff --git a/Mac/OSX/IDLE/Makefile.in b/Mac/OSX/IDLE/Makefile.in new file mode 100644 index 0000000000..6f675a2d16 --- /dev/null +++ b/Mac/OSX/IDLE/Makefile.in @@ -0,0 +1,49 @@ +prefix=@prefix@ +CC=@CC@ +LD=@CC@ +BASECFLAGS=@BASECFLAGS@ +OPT=@OPT@ +CFLAGS=$(BASECFLAGS) $(OPT) +LDFLAGS=@LDFLAGS@ +srcdir= @srcdir@ +VERSION= @VERSION@ +UNIVERSALSDK=@UNIVERSALSDK@ +builddir= ../../.. + +RUNSHARED= @RUNSHARED@ +BUILDEXE= @BUILDEXEEXT@ +BUILDPYTHON= ../../../python$(BUILDEXE) + +# Deployment target selected during configure, to be checked +# by distutils +MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@ +@EXPORT_MACOSX_DEPLOYMENT_TARGET@export MACOSX_DEPLOYMENT_TARGET + +BUNDLEBULDER=$(srcdir)/../../../Lib/plat-mac/bundlebuilder.py + +PYTHONAPPSDIR=/Applications/MacPython $(VERSION) + +all: IDLE.app + +install: IDLE.app + test -d "$(DESTDIR)$(PYTHONAPPSDIR)" || mkdir -p "$(DESTDIR)$(PYTHONAPPSDIR)" + -test -d "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app" && rm -r "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app" + cp -PR IDLE.app "$(DESTDIR)$(PYTHONAPPSDIR)" + touch "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app" + +clean: + rm -rf IDLE.app + +IDLE.app: \ + $(srcdir)/../../OSXResources/app/Resources/PythonApplet.icns \ + $(srcdir)/idlemain.py + rm -fr PythonLauncher.app + $(RUNSHARED) $(BUILDPYTHON) $(BUNDLEBULDER) \ + --builddir=. \ + --name=IDLE \ + --link-exec \ + --plist=$(srcdir)/Info.plist \ + --mainprogram=$(srcdir)/idlemain.py \ + --iconfile=$(srcdir)/IDLE.icns \ + --python=$(prefix)/Resources/Python.app/Contents/MacOS/Python \ + build diff --git a/Mac/OSX/IDLE/idlemain.py b/Mac/OSX/IDLE/idlemain.py new file mode 100644 index 0000000000..aa75d4cb15 --- /dev/null +++ b/Mac/OSX/IDLE/idlemain.py @@ -0,0 +1,27 @@ +""" +Bootstrap script for IDLE as an application bundle. +""" +import sys, os + +from idlelib.PyShell import main + +# Change the current directory the user's home directory, that way we'll get +# a more useful default location in the open/save dialogs. +os.chdir(os.path.expanduser('~/Documents')) + + +# Make sure sys.executable points to the python interpreter inside the +# framework, instead of at the helper executable inside the application +# bundle (the latter works, but doesn't allow access to the window server) +sys.executable = os.path.join(sys.prefix, 'bin', 'python') + +# Look for the -psn argument that the launcher adds and remove it, it will +# only confuse the IDLE startup code. +for idx, value in enumerate(sys.argv): + if value.startswith('-psn_'): + del sys.argv[idx] + break + +#argvemulator.ArgvCollector().mainloop() +if __name__ == '__main__': + main() diff --git a/Mac/OSX/Makefile b/Mac/OSX/Makefile deleted file mode 100644 index 6b0f2ed5ad..0000000000 --- a/Mac/OSX/Makefile +++ /dev/null @@ -1,273 +0,0 @@ -# This file can be invoked from the various frameworkinstall... targets in the -# main Makefile. The next couple of variables are overridden on the -# commandline in that case. - -VERSION=2.4 -builddir = ../.. -srcdir = ../.. -prefix=/Library/Frameworks/Python.framework/Versions/$(VERSION) -LIBDEST=$(prefix)/lib/python$(VERSION) -BUILDPYTHON=$(builddir)/python.exe -DESTDIR= -# Test whether to use xcodebuild (preferred) or pbxbuild: -ifeq ($(shell ls /usr/bin/xcodebuild),/usr/bin/xcodebuild) -PBXBUILD=xcodebuild -else -PBXBUILD=pbxbuild -endif - -# These are normally glimpsed from the previous set -bindir=/usr/local/bin -PYTHONAPPSPATH=/Applications/MacPython-$(VERSION) -PYTHONAPPSDIR=$(PYTHONAPPSPATH) -APPINSTALLDIR=$(prefix)/Resources/Python.app - -# Variables for installing the "normal" unix binaries -INSTALLED_PYTHON=$(prefix)/bin/python -INSTALLED_PYTHONW=$(APPINSTALLDIR)/Contents/MacOS/Python - -# Items more-or-less copied from the main Makefile -DIRMODE=755 -FILEMODE=644 -INSTALL=/usr/bin/install -c -INSTALL_SYMLINK=ln -fsn -INSTALL_PROGRAM=${INSTALL} -INSTALL_SCRIPT= ${INSTALL_PROGRAM} -INSTALL_DATA= ${INSTALL} -m ${FILEMODE} -LN=ln -STRIPFLAG=-s -##OPT=-g -O3 -Wall -Wstrict-prototypes -Wno-long-double -no-cpp-precomp \ -## -fno-common -dynamic -##INCLUDES=-I$(builddir) -I$(srcdir)/Include -I$(srcdir)/Mac/Include -##DEFINES= -## -##CFLAGS=$(OPT) $(DEFINES) $(INCLUDES) -##LDFLAGS=-F$(builddir) -framework System -framework Python -framework Carbon \ -## -framework Foundation -##CC=cc -##LD=cc -CPMAC=/Developer/Tools/CpMac - -APPTEMPLATE=$(srcdir)/Mac/OSXResources/app -APPSUBDIRS=MacOS Resources Resources/English.lproj \ - Resources/English.lproj/Documentation \ - Resources/English.lproj/Documentation/doc \ - Resources/English.lproj/Documentation/ide -DOCDIR=$(srcdir)/Mac/OSXResources/app/Resources/English.lproj/Documentation -DOCINDEX=$(DOCDIR)/"Documentation idx" -CACHERSRC=$(srcdir)/Mac/scripts/cachersrc.py -compileall=$(srcdir)/Lib/compileall.py -bundlebuilder=$(srcdir)/Lib/plat-mac/bundlebuilder.py - -installapps: install_PythonLauncher install_Python install_BuildApplet install_IDE \ - install_IDLE install_PackageManager checkapplepython - -install_PythonLauncher: - cd $(srcdir)/Mac/OSX/PythonLauncher/PythonLauncher.pbproj ; \ - $(PBXBUILD) -target PythonLauncher -buildstyle Deployment install \ - DSTROOT=$(DESTDIR)/ INSTALL_PATH=$(PYTHONAPPSPATH) - -install_Python: - @if test ! -f $(DOCINDEX); then \ - echo WARNING: you should run Apple Help Indexing Tool on $(DOCDIR); \ - fi - @for i in $(PYTHONAPPSDIR) $(APPINSTALLDIR) $(APPINSTALLDIR)/Contents; do \ - if test ! -d $(DESTDIR)$$i; then \ - echo "Creating directory $(DESTDIR)$$i"; \ - $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \ - fi;\ - done - @for i in $(APPSUBDIRS); do \ - if test ! -d $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i; then \ - echo "Creating directory $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \ - $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i; \ - else true; \ - fi; \ - done - @for d in . $(APPSUBDIRS); \ - do \ - a=$(APPTEMPLATE)/$$d; \ - if test ! -d $$a; then continue; else true; fi; \ - b=$(DESTDIR)$(APPINSTALLDIR)/Contents/$$d; \ - for i in $$a/*; \ - do \ - case $$i in \ - *CVS) ;; \ - *.py[co]) ;; \ - *.orig) ;; \ - *~) ;; \ - *idx) \ - echo $(CPMAC) "$$i" $$b; \ - $(CPMAC) "$$i" $$b; \ - ;; \ - *) \ - if test -d $$i; then continue; fi; \ - if test -x $$i; then \ - echo $(INSTALL_SCRIPT) $$i $$b; \ - $(INSTALL_SCRIPT) $$i $$b; \ - else \ - echo $(INSTALL_DATA) $$i $$b; \ - $(INSTALL_DATA) $$i $$b; \ - fi;; \ - esac; \ - done; \ - done - $(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) $(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/Python - -install_IDE: - @if ! $(BUILDPYTHON) -c "import waste"; then \ - echo PythonIDE needs the \"waste\" extension module; \ - echo See Mac/OSX/README for details; \ - else \ - echo $(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \ - --destroot "$(DESTDIR)" \ - --python $(INSTALLED_PYTHONW) \ - --output $(DESTDIR)$(PYTHONAPPSDIR)/PythonIDE.app --noargv \ - $(srcdir)/Mac/Tools/IDE/PythonIDE.py ; \ - $(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \ - --destroot "$(DESTDIR)" \ - --python $(INSTALLED_PYTHONW) \ - --output $(DESTDIR)$(PYTHONAPPSDIR)/PythonIDE.app --noargv \ - $(srcdir)/Mac/Tools/IDE/PythonIDE.py; \ - fi - -install_PackageManager: - @if ! $(BUILDPYTHON) -c "import waste"; then \ - echo PackageManager needs the \"waste\" extension module; \ - echo See Mac/OSX/README for details; \ - else \ - echo $(BUILDPYTHON) $(bundlebuilder) \ - --builddir $(DESTDIR)$(PYTHONAPPSDIR)/ \ - --destroot "$(DESTDIR)" \ - --python $(INSTALLED_PYTHONW) \ - --resource $(srcdir)/Mac/Tools/IDE/PythonIDE.rsrc \ - --mainprogram $(srcdir)/Mac/Tools/IDE/PackageManager.py \ - --iconfile $(srcdir)/Mac/Tools/IDE/PackageManager.icns \ - --creator Pimp build; \ - $(BUILDPYTHON) $(bundlebuilder) \ - --builddir $(DESTDIR)$(PYTHONAPPSDIR)/ \ - --destroot "$(DESTDIR)" \ - --python $(INSTALLED_PYTHONW) \ - --resource $(srcdir)/Mac/Tools/IDE/PythonIDE.rsrc \ - --mainprogram $(srcdir)/Mac/Tools/IDE/PackageManager.py \ - --iconfile $(srcdir)/Mac/Tools/IDE/PackageManager.icns \ - --creator Pimp build; \ - fi - -install_IDLE: - @if ! $(BUILDPYTHON) -c "import _tkinter"; then \ - echo IDLE needs the \"Tkinter\" extension module; \ - echo See Mac/OSX/README for details; \ - else \ - echo $(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \ - --python $(INSTALLED_PYTHONW) \ - --destroot "$(DESTDIR)" \ - --output $(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app \ - --extra $(srcdir)/Lib/idlelib \ - $(srcdir)/Tools/scripts/idle ; \ - $(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \ - --python $(INSTALLED_PYTHONW) \ - --destroot "$(DESTDIR)" \ - --output $(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app \ - --extra $(srcdir)/Lib/idlelib:Contents/Resources/idlelib \ - $(srcdir)/Tools/scripts/idle ; \ - fi - - -install_BuildApplet: - $(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \ - --destroot "$(DESTDIR)" \ - --python $(INSTALLED_PYTHONW) \ - --output $(DESTDIR)$(PYTHONAPPSDIR)/BuildApplet.app \ - $(srcdir)/Mac/scripts/BuildApplet.py - -MACLIBDEST=$(LIBDEST)/plat-mac -MACTOOLSDEST=$(prefix)/Mac/Tools -MACTOOLSSRC=$(srcdir)/Mac/Tools -MACTOOLSSUBDIRS=IDE -installmacsubtree: - @for i in $(MACTOOLSDEST); \ - do \ - if test ! -d $(DESTDIR)$$i; then \ - echo "Creating directory $(DESTDIR)$$i"; \ - $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \ - else true; \ - fi; \ - done - @for d in $(MACTOOLSSUBDIRS); \ - do \ - a=$(MACTOOLSSRC)/$$d; \ - if test ! -d $$a; then continue; else true; fi; \ - b=$(DESTDIR)$(MACTOOLSDEST)/$$d; \ - if test ! -d $$b; then \ - echo "Creating directory $$b"; \ - $(INSTALL) -d -m $(DIRMODE) $$b; \ - else true; \ - fi; \ - done - @for d in $(MACTOOLSSUBDIRS); \ - do \ - a=$(MACTOOLSSRC)/$$d; \ - if test ! -d $$a; then continue; else true; fi; \ - b=$(DESTDIR)$(MACTOOLSDEST)/$$d; \ - for i in $$a/*; \ - do \ - case $$i in \ - *CVS) ;; \ - *.py[co]) ;; \ - *.orig) ;; \ - *~) ;; \ - *.rsrc) \ - echo $(CPMAC) $$i $$b ; \ - $(CPMAC) $$i $$b ; \ - ;; \ - *) \ - if test -d $$i; then continue; fi; \ - if test -x $$i; then \ - echo $(INSTALL_SCRIPT) $$i $$b; \ - $(INSTALL_SCRIPT) $$i $$b; \ - else \ - echo $(INSTALL_DATA) $$i $$b; \ - $(INSTALL_DATA) $$i $$b; \ - fi;; \ - esac; \ - done; \ - done - - - $(BUILDPYTHON) $(CACHERSRC) -v $(DESTDIR)$(MACLIBDEST) $(DESTDIR)$(MACTOOLSDEST) - $(BUILDPYTHON) -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST) - $(BUILDPYTHON) -O -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST) - -# -# We use the full name here in stead of $(INSTALLED_PYTHONW), because -# the latter may be overridden by Makefile.jaguar when building for a pre-installed -# /usr/bin/python -$(APPINSTALLDIR)/Contents/MacOS/Python: install_Python - -# $(INSTALLED_PYTHON) has to be done by the main Makefile, we cannot do that here. -# At least this rule will give an error if it doesn't exist. - -installunixtools: - $(INSTALL) -d $(DESTDIR)$(bindir) - $(INSTALL_SYMLINK) $(INSTALLED_PYTHON) $(DESTDIR)$(bindir)/python$(VERSION) - $(INSTALL_SYMLINK) python$(VERSION) $(DESTDIR)$(bindir)/python - echo "#!/bin/sh" > pythonw.sh - echo "exec \"$(INSTALLED_PYTHONW)\" \"\$$@\"" >> pythonw.sh - $(INSTALL) pythonw.sh $(DESTDIR)$(bindir)/pythonw$(VERSION) - $(INSTALL_SYMLINK) pythonw$(VERSION) $(DESTDIR)$(bindir)/pythonw - -installextras: - $(INSTALL) -d $(DESTDIR)$(PYTHONAPPSDIR)/Extras - $(INSTALL) $(srcdir)/Mac/OSX/Extras.ReadMe.txt $(DESTDIR)$(PYTHONAPPSDIR)/Extras/ReadMe - $(BUILDPYTHON) $(srcdir)/Mac/OSX/Extras.install.py $(srcdir)/Demo \ - $(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo - $(BUILDPYTHON) $(srcdir)/Mac/OSX/Extras.install.py $(srcdir)/Tools \ - $(DESTDIR)$(PYTHONAPPSDIR)/Extras/Tools - -checkapplepython: - @if ! $(BUILDPYTHON) $(srcdir)/Mac/OSX/fixapplepython23.py -n; then \ - echo "* WARNING: Apple-installed Python 2.3 will have trouble building extensions from now on."; \ - echo "* WARNING: Run $(srcdir)/Mac/OSX/fixapplepython23.py with \"sudo\" to fix this."; \ - fi - diff --git a/Mac/OSX/Makefile.in b/Mac/OSX/Makefile.in new file mode 100644 index 0000000000..8ec7c263e5 --- /dev/null +++ b/Mac/OSX/Makefile.in @@ -0,0 +1,294 @@ +# This file can be invoked from the various frameworkinstall... targets in the +# main Makefile. The next couple of variables are overridden on the +# commandline in that case. + +VERSION=@VERSION@ +builddir = ../.. +srcdir = @srcdir@ +prefix=/Library/Frameworks/Python.framework/Versions/$(VERSION) +LIBDEST=$(prefix)/lib/python$(VERSION) +BUILDPYTHON=$(builddir)/python.exe +RUNSHARED= @RUNSHARED@ +DESTDIR= +LDFLAGS=@LDFLAGS@ +FRAMEWORKUNIXTOOLSPREFIX=@FRAMEWORKUNIXTOOLSPREFIX@ + + +# These are normally glimpsed from the previous set +bindir=@exec_prefix@/bin +PYTHONAPPSPATH=/Applications/MacPython $(VERSION) +PYTHONAPPSDIR=$(PYTHONAPPSPATH) +APPINSTALLDIR=$(prefix)/Resources/Python.app + +# Variables for installing the "normal" unix binaries +INSTALLED_PYDOC=$(prefix)/bin/pydoc +INSTALLED_PYTHON=$(prefix)/bin/python +INSTALLED_PYTHONW=$(prefix)/bin/pythonw +INSTALLED_PYTHONAPP=$(APPINSTALLDIR)/Contents/MacOS/Python + +# Items more-or-less copied from the main Makefile +DIRMODE=755 +FILEMODE=644 +INSTALL=@INSTALL@ +INSTALL_SYMLINK=ln -fsn +INSTALL_PROGRAM=@INSTALL_PROGRAM@ +INSTALL_SCRIPT=@INSTALL_SCRIPT@ +INSTALL_DATA=@INSTALL_DATA@ +LN=@LN@ +STRIPFLAG=-s +CPMAC=/Developer/Tools/CpMac + +APPTEMPLATE=$(srcdir)/../OSXResources/app +APPSUBDIRS=MacOS Resources Resources/English.lproj \ + Resources/English.lproj/Documentation \ + Resources/English.lproj/Documentation/doc \ + Resources/English.lproj/Documentation/ide +DOCDIR=$(srcdir)/../OSXResources/app/Resources/English.lproj/Documentation +DOCINDEX=$(DOCDIR)/"Documentation idx" +CACHERSRC=$(srcdir)/../scripts/cachersrc.py +compileall=$(srcdir)/../../Lib/compileall.py + +installapps: install_PythonLauncher install_Python install_BuildApplet install_IDE \ + install_IDLE install_PackageManager checkapplepython install_pythonw \ + install_versionedtools + +install_pythonw: pythonw + $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)" + $(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/python$(VERSION)" + ln -sf python$(VERSION) "$(DESTDIR)$(prefix)/bin/python" + ln -sf pythonw$(VERSION) "$(DESTDIR)$(prefix)/bin/pythonw" + +pythonw: $(srcdir)/pythonw.c + $(CC) $(LDFLAGS) -o $@ $(srcdir)/pythonw.c \ + -DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/Python"' + +install_PythonLauncher: + cd PythonLauncher && make install + +install_Python: + @if test ! -f $(DOCINDEX); then \ + echo WARNING: you should run Apple Help Indexing Tool on $(DOCDIR); \ + fi + @for i in "$(PYTHONAPPSDIR)" "$(APPINSTALLDIR)" "$(APPINSTALLDIR)/Contents"; do \ + if test ! -d $(DESTDIR)$$i; then \ + echo "Creating directory $(DESTDIR)$$i"; \ + $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$$i"; \ + fi;\ + done + @for i in $(APPSUBDIRS); do \ + if test ! -d $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i; then \ + echo "Creating directory $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \ + $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \ + else true; \ + fi; \ + done + @for d in . $(APPSUBDIRS); \ + do \ + a=$(APPTEMPLATE)/$$d; \ + if test ! -d $$a; then continue; else true; fi; \ + b="$(DESTDIR)$(APPINSTALLDIR)/Contents/$$d"; \ + for i in $$a/*; \ + do \ + case $$i in \ + *CVS) ;; \ + *.py[co]) ;; \ + *.orig) ;; \ + *~) ;; \ + *idx) \ + echo $(CPMAC) "$$i" $$b; \ + $(CPMAC) "$$i" $$b; \ + ;; \ + *) \ + if test -d "$$i"; then continue; fi; \ + if test -x "$$i"; then \ + echo $(INSTALL_SCRIPT) "$$i" "$$b"; \ + $(INSTALL_SCRIPT) "$$i" "$$b"; \ + else \ + echo $(INSTALL_DATA) "$$i" "$$b"; \ + $(INSTALL_DATA) "$$i" "$$b"; \ + fi;; \ + esac; \ + done; \ + done + $(INSTALL_PROGRAM) $(STRIPFLAG) "$(BUILDPYTHON)" "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/Python" + +install_IDE: + @if ! $(RUNSHARED) $(BUILDPYTHON) -c "import waste"; then \ + echo PythonIDE needs the \"waste\" extension module; \ + echo See Mac/OSX/README for details; \ + else \ + echo $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/../scripts/BuildApplet.py \ + --destroot "$(DESTDIR)" \ + --python "$(INSTALLED_PYTHONAPP)" \ + --output "$(DESTDIR)$(PYTHONAPPSDIR)/PythonIDE.app" --noargv \ + $(srcdir)/Mac/Tools/IDE/PythonIDE.py ; \ + $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/../scripts/BuildApplet.py \ + --destroot "$(DESTDIR)" \ + --python "$(INSTALLED_PYTHONAPP)" \ + --output "$(DESTDIR)$(PYTHONAPPSDIR)/PythonIDE.app" --noargv \ + $(srcdir)/Mac/Tools/IDE/PythonIDE.py; \ + fi + +install_PackageManager: + @if ! $(RUNSHARED) $(BUILDPYTHON) -c "import waste"; then \ + echo PackageManager needs the \"waste\" extension module; \ + echo See Mac/OSX/README for details; \ + else \ + echo $(RUNSHARED) $(BUILDPYTHON) $(bundlebuilder) \ + --builddir $(DESTDIR)$(PYTHONAPPSDIR)/ \ + --destroot "$(DESTDIR)" \ + --python $(INSTALLED_PYTHONAPP) \ + --resource $(srcdir)/Mac/Tools/IDE/PythonIDE.rsrc \ + --mainprogram $(srcdir)/Mac/Tools/IDE/PackageManager.py \ + --iconfile $(srcdir)/Mac/Tools/IDE/PackageManager.icns \ + --creator Pimp build; \ + $(RUNSHARED) $(BUILDPYTHON) $(bundlebuilder) \ + --builddir $(DESTDIR)$(PYTHONAPPSDIR)/ \ + --destroot "$(DESTDIR)" \ + --python $(INSTALLED_PYTHONAPP) \ + --resource $(srcdir)/Mac/Tools/IDE/PythonIDE.rsrc \ + --mainprogram $(srcdir)/Mac/Tools/IDE/PackageManager.py \ + --iconfile $(srcdir)/Mac/Tools/IDE/PackageManager.icns \ + --creator Pimp build; \ + fi + +install_IDLE: + @if ! $(RUNSHARED) $(BUILDPYTHON) -c "import _tkinter"; then \ + echo IDLE needs the \"Tkinter\" extension module; \ + echo See Mac/OSX/README for details; \ + else \ + cd IDLE && make install ;\ + fi + + +install_BuildApplet: + $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/../scripts/BuildApplet.py \ + --destroot "$(DESTDIR)" \ + --python "$(INSTALLED_PYTHONAPP)" \ + --output "$(DESTDIR)$(PYTHONAPPSDIR)/BuildApplet.app" \ + "$(srcdir)/../scripts/BuildApplet.py" + +MACLIBDEST=$(LIBDEST)/plat-mac +MACTOOLSDEST=$(prefix)/Mac/Tools +MACTOOLSSRC=$(srcdir)/Mac/Tools +MACTOOLSSUBDIRS=IDE +installmacsubtree: + @for i in $(MACTOOLSDEST); \ + do \ + if test ! -d $(DESTDIR)$$i; then \ + echo "Creating directory $(DESTDIR)$$i"; \ + $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \ + else true; \ + fi; \ + done + @for d in $(MACTOOLSSUBDIRS); \ + do \ + a=$(MACTOOLSSRC)/$$d; \ + if test ! -d $$a; then continue; else true; fi; \ + b=$(DESTDIR)$(MACTOOLSDEST)/$$d; \ + if test ! -d $$b; then \ + echo "Creating directory $$b"; \ + $(INSTALL) -d -m $(DIRMODE) $$b; \ + else true; \ + fi; \ + done + @for d in $(MACTOOLSSUBDIRS); \ + do \ + a=$(MACTOOLSSRC)/$$d; \ + if test ! -d $$a; then continue; else true; fi; \ + b=$(DESTDIR)$(MACTOOLSDEST)/$$d; \ + for i in $$a/*; \ + do \ + case $$i in \ + *CVS) ;; \ + *.py[co]) ;; \ + *.orig) ;; \ + *~) ;; \ + *.rsrc) \ + echo $(CPMAC) $$i $$b ; \ + $(CPMAC) $$i $$b ; \ + ;; \ + *) \ + if test -d $$i; then continue; fi; \ + if test -x $$i; then \ + echo $(INSTALL_SCRIPT) $$i $$b; \ + $(INSTALL_SCRIPT) $$i $$b; \ + else \ + echo $(INSTALL_DATA) $$i $$b; \ + $(INSTALL_DATA) $$i $$b; \ + fi;; \ + esac; \ + done; \ + done + + + $(RUNSHARED) $(BUILDPYTHON) $(CACHERSRC) -v $(DESTDIR)$(MACLIBDEST) $(DESTDIR)$(MACTOOLSDEST) + $(RUNSHARED) $(BUILDPYTHON) -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST) + $(RUNSHARED) $(BUILDPYTHON) -O -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST) + +# +# We use the full name here in stead of $(INSTALLED_PYTHONAPP), because +# the latter may be overridden by Makefile.jaguar when building for a pre-installed +# /usr/bin/python +$(APPINSTALLDIR)/Contents/MacOS/Python: install_Python + +# $(INSTALLED_PYTHON) has to be done by the main Makefile, we cannot do that here. +# At least this rule will give an error if it doesn't exist. + +installunixtools: + if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \ + $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\ + fi + for fn in python pythonw idle pydoc smtpd.py \ + python$(VERSION) pythonw$(VERSION) idle$(VERSION) \ + pydoc$(VERSION) smtpd$(VERSION).py ;\ + do \ + ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\ + done + +# +# Like installunixtools, but only install links to the versioned binaries. + +altinstallunixtools: + if [ ! -d "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ]; then \ + $(INSTALL) -d -m $(DIRMODE) "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin" ;\ + fi + for fn in python$(VERSION) pythonw$(VERSION) idle$(VERSION) \ + pydoc$(VERSION) smtpd$(VERSION).py ;\ + do \ + ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\ + done + + + +installextras:$(srcdir)/Extras.ReadMe.txt $(srcdir)/Extras.install.py + $(INSTALL) -d "$(DESTDIR)$(PYTHONAPPSDIR)/Extras" + $(INSTALL) $(srcdir)/Extras.ReadMe.txt "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/ReadMe" + $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/../Demo \ + "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo.Mac" + $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/../../Demo \ + "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo" + +checkapplepython: + @if ! $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/fixapplepython23.py -n; then \ + echo "* WARNING: Apple-installed Python 2.3 will have trouble building extensions from now on."; \ + echo "* WARNING: Run $(srcdir)/fixapplepython23.py with \"sudo\" to fix this."; \ + fi + +# By default most tools are installed without a version in their basename, to +# make it easier to install (and use) several python versions side-by-side move +# the tools to a version-specific name and add the non-versioned name as an +# alias. +install_versionedtools: + for fn in idle pydoc ;\ + do \ + if [ -h "$(DESTDIR)$(prefix)/bin/$${fn}" ]; then \ + continue ;\ + fi ;\ + mv "$(DESTDIR)$(prefix)/bin/$${fn}" "$(DESTDIR)$(prefix)/bin/$${fn}$(VERSION)" ;\ + ln -sf "$${fn}$(VERSION)" "$(DESTDIR)$(prefix)/bin/$${fn}" ;\ + done + if [ ! -h "$(DESTDIR)$(prefix)/bin/smtpd.py" ]; then \ + mv "$(DESTDIR)$(prefix)/bin/smtpd.py" "$(DESTDIR)$(prefix)/bin/smtpd$(VERSION).py" ;\ + ln -sf "smtpd$(VERSION).py" "$(DESTDIR)$(prefix)/bin/smtpd.py" ;\ + fi diff --git a/Mac/OSX/PythonLauncher/FileSettings.m b/Mac/OSX/PythonLauncher/FileSettings.m index fc3937b3dc..5722223498 100755 --- a/Mac/OSX/PythonLauncher/FileSettings.m +++ b/Mac/OSX/PythonLauncher/FileSettings.m @@ -207,7 +207,7 @@ [NSNumber numberWithBool: inspect], @"inspect", [NSNumber numberWithBool: optimize], @"optimize", [NSNumber numberWithBool: nosite], @"nosite", - [NSNumber numberWithBool: nosite], @"nosite", + [NSNumber numberWithBool: tabs], @"tabs", others, @"others", scriptargs, @"scriptargs", [NSNumber numberWithBool: with_terminal], @"with_terminal", @@ -235,7 +235,7 @@ if (value) optimize = [value boolValue]; value = [dict objectForKey: @"nosite"]; if (value) nosite = [value boolValue]; - value = [dict objectForKey: @"nosite"]; + value = [dict objectForKey: @"tabs"]; if (value) tabs = [value boolValue]; value = [dict objectForKey: @"others"]; if (value) others = [value retain]; @@ -245,12 +245,26 @@ if (value) with_terminal = [value boolValue]; } +- (NSString*)_replaceSingleQuotes: (NSString*)string +{ + /* Replace all single-quotes by '"'"', that way shellquoting will + * be correct when the result value is delimited using single quotes. + */ + NSArray* components = [string componentsSeparatedByString:@"'"]; + + return [components componentsJoinedByString:@"'\"'\"'"]; +} + - (NSString *)commandLineForScript: (NSString *)script { NSString *cur_interp = NULL; + NSString* script_dir = NULL; char hashbangbuf[1024]; FILE *fp; char *p; + + script_dir = [script substringToIndex: + [script length]-[[script lastPathComponent] length]]; if (honourhashbang && (fp=fopen([script cString], "r")) && @@ -266,8 +280,9 @@ cur_interp = interpreter; return [NSString stringWithFormat: - @"\"%@\"%s%s%s%s%s%s %@ \"%@\" %@ %s", - cur_interp, + @"cd '%@' && '%@'%s%s%s%s%s%s %@ '%@' %@ %s", + [self _replaceSingleQuotes:script_dir], + [self _replaceSingleQuotes:cur_interp], debug?" -d":"", verbose?" -v":"", inspect?" -i":"", @@ -275,7 +290,7 @@ nosite?" -S":"", tabs?" -t":"", others, - script, + [self _replaceSingleQuotes:script], scriptargs, with_terminal? "&& echo Exit status: $? && exit 1" : " &"]; } diff --git a/Mac/OSX/PythonLauncher/Info.plist b/Mac/OSX/PythonLauncher/Info.plist new file mode 100644 index 0000000000..6537f32298 --- /dev/null +++ b/Mac/OSX/PythonLauncher/Info.plist @@ -0,0 +1,65 @@ +<?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>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleDocumentTypes</key> + <array> + <dict> + <key>CFBundleTypeExtensions</key> + <array> + <string>py</string> + <string>pyw</string> + </array> + <key>CFBundleTypeIconFile</key> + <string>PythonSource.icns</string> + <key>CFBundleTypeName</key> + <string>Python Script</string> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + <key>NSDocumentClass</key> + <string>MyDocument</string> + </dict> + <dict> + <key>CFBundleTypeExtensions</key> + <array> + <string>pyc</string> + <string>pyo</string> + </array> + <key>CFBundleTypeIconFile</key> + <string>PythonCompiled.icns</string> + <key>CFBundleTypeName</key> + <string>Python Bytecode Document</string> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + <key>NSDocumentClass</key> + <string>MyDocument</string> + </dict> + </array> + <key>CFBundleExecutable</key> + <string>PythonLauncher</string> + <key>CFBundleGetInfoString</key> + <string>2.4, © 2001-2006 Python Software Foundation</string> + <key>CFBundleIconFile</key> + <string>PythonInterpreter.icns</string> + <key>CFBundleIdentifier</key> + <string>org.python.PythonLauncher</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>Python Launcher</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleShortVersionString</key> + <string>2.4</string> + <key>CFBundleSignature</key> + <string>PytL</string> + <key>CFBundleVersion</key> + <string>2.4</string> + <key>NSMainNibFile</key> + <string>MainMenu</string> + <key>NSPrincipalClass</key> + <string>NSApplication</string> +</dict> +</plist> diff --git a/Mac/OSX/PythonLauncher/Makefile.in b/Mac/OSX/PythonLauncher/Makefile.in new file mode 100644 index 0000000000..5f155be8a5 --- /dev/null +++ b/Mac/OSX/PythonLauncher/Makefile.in @@ -0,0 +1,81 @@ +CC=@CC@ +LD=@CC@ +BASECFLAGS=@BASECFLAGS@ +OPT=@OPT@ +CFLAGS=$(BASECFLAGS) $(OPT) +LDFLAGS=@LDFLAGS@ +srcdir= @srcdir@ +VERSION= @VERSION@ +UNIVERSALSDK=@UNIVERSALSDK@ +builddir= ../../.. + +RUNSHARED= @RUNSHARED@ +BUILDEXE= @BUILDEXEEXT@ +BUILDPYTHON= ../../../python$(BUILDEXE) + +# Deployment target selected during configure, to be checked +# by distutils +MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@ +@EXPORT_MACOSX_DEPLOYMENT_TARGET@export MACOSX_DEPLOYMENT_TARGET + +BUNDLEBULDER=$(srcdir)/../../../Lib/plat-mac/bundlebuilder.py + +PYTHONAPPSDIR=/Applications/MacPython $(VERSION) +OBJECTS=FileSettings.o MyAppDelegate.o MyDocument.o PreferencesWindowController.o doscript.o main.o + +all: PythonLauncher.app + +install: PythonLauncher.app + test -d "$(DESTDIR)$(PYTHONAPPSDIR)" || mkdir -p "$(DESTDIR)$(PYTHONAPPSDIR)" + -test -d "$(DESTDIR)$(PYTHONAPPSDIR)/PythonLauncher.app" && rm -r "$(DESTDIR)$(PYTHONAPPSDIR)/PythonLauncher.app" + cp -r "PythonLauncher.app" "$(DESTDIR)$(PYTHONAPPSDIR)" + touch "$(DESTDIR)$(PYTHONAPPSDIR)/PythonLauncher.app" + +clean: + rm -f *.o "PythonLauncher" + rm -rf "PythonLauncher.app" + +PythonLauncher.app: \ + PythonLauncher $(srcdir)/PythonInterpreter.icns \ + $(srcdir)/PythonSource.icns \ + $(srcdir)/PythonWSource.icns \ + $(srcdir)/PythonCompiled.icns \ + $(srcdir)/factorySettings.plist + rm -fr "PythonLauncher.app" + $(RUNSHARED) $(BUILDPYTHON) $(BUNDLEBULDER) \ + --builddir=. \ + --name="PythonLauncher" \ + --executable="PythonLauncher" \ + --iconfile=$(srcdir)/PythonInterpreter.icns \ + --bundle-id=org.python.PythonLauncher \ + --resource=$(srcdir)/PythonSource.icns \ + --resource=$(srcdir)/PythonWSource.icns \ + --resource=$(srcdir)/PythonCompiled.icns \ + --resource=$(srcdir)/English.lproj \ + --resource=$(srcdir)/PreferenceWindow.nib \ + --resource=$(srcdir)/factorySettings.plist \ + --plist=$(srcdir)/Info.plist \ + build + find "PythonLauncher.app" -name '.svn' -print0 | xargs -0 rm -r + + +FileSettings.o: $(srcdir)/FileSettings.m + $(CC) $(CFLAGS) -o $@ -c $(srcdir)/FileSettings.m + +MyAppDelegate.o: $(srcdir)/MyAppDelegate.m + $(CC) $(CFLAGS) -o $@ -c $(srcdir)/MyAppDelegate.m + +MyDocument.o: $(srcdir)/MyDocument.m + $(CC) $(CFLAGS) -o $@ -c $(srcdir)/MyDocument.m + +PreferencesWindowController.o: $(srcdir)/PreferencesWindowController.m + $(CC) $(CFLAGS) -o $@ -c $(srcdir)/PreferencesWindowController.m + +doscript.o: $(srcdir)/doscript.m + $(CC) $(CFLAGS) -o $@ -c $(srcdir)/doscript.m + +main.o: $(srcdir)/main.m + $(CC) $(CFLAGS) -o $@ -c $(srcdir)/main.m + +PythonLauncher: $(OBJECTS) + $(CC) $(LDFLAGS) -o "PythonLauncher" $(OBJECTS) -framework AppKit -framework Carbon diff --git a/Mac/OSX/PythonLauncher/PythonCompiled.icns b/Mac/OSX/PythonLauncher/PythonCompiled.icns Binary files differindex afead3e42e..7d9f3202c7 100644 --- a/Mac/OSX/PythonLauncher/PythonCompiled.icns +++ b/Mac/OSX/PythonLauncher/PythonCompiled.icns diff --git a/Mac/OSX/PythonLauncher/PythonInterpreter.icns b/Mac/OSX/PythonLauncher/PythonInterpreter.icns Binary files differindex d5dd12fde3..e09fd381e4 100644 --- a/Mac/OSX/PythonLauncher/PythonInterpreter.icns +++ b/Mac/OSX/PythonLauncher/PythonInterpreter.icns diff --git a/Mac/OSX/PythonLauncher/PythonSource.icns b/Mac/OSX/PythonLauncher/PythonSource.icns Binary files differindex 4ac7a96874..9e35c1ecbe 100644 --- a/Mac/OSX/PythonLauncher/PythonSource.icns +++ b/Mac/OSX/PythonLauncher/PythonSource.icns diff --git a/Mac/OSX/PythonLauncher/PythonWSource.icns b/Mac/OSX/PythonLauncher/PythonWSource.icns Binary files differindex b0a859323b..9e35c1ecbe 100644 --- a/Mac/OSX/PythonLauncher/PythonWSource.icns +++ b/Mac/OSX/PythonLauncher/PythonWSource.icns diff --git a/Mac/OSX/fixapplepython23.py b/Mac/OSX/fixapplepython23.py index 181181ea79..6ba54019f0 100644 --- a/Mac/OSX/fixapplepython23.py +++ b/Mac/OSX/fixapplepython23.py @@ -1,3 +1,4 @@ +#!/usr/bin/python """fixapplepython23 - Fix Apple-installed Python 2.3 (on Mac OS X 10.3) Python 2.3 (and 2.3.X for X<5) have the problem that building an extension @@ -93,9 +94,19 @@ def main(): else: do_apply = True # First check OS version + if sys.byteorder == 'little': + # All intel macs are fine + print "fixapplypython23: no fix is needed on MacOSX on Intel" + sys.exit(0) + if gestalt.gestalt('sysv') < 0x1030: print 'fixapplepython23: no fix needed on MacOSX < 10.3' sys.exit(0) + + if gestalt.gestalt('sysv') >= 0x1040: + print 'fixapplepython23: no fix needed on MacOSX >= 10.4' + sys.exit(0) + # Test that a framework Python is indeed installed if not os.path.exists(MAKEFILE): print 'fixapplepython23: Python framework does not appear to be installed (?), nothing fixed' @@ -112,7 +123,8 @@ def main(): makescript(GXX_SCRIPT, "g++") # Finally fix the makefile rv = fix(MAKEFILE, do_apply) - sys.exit(rv) + #sys.exit(rv) + sys.exit(0) if __name__ == '__main__': main() diff --git a/Mac/OSX/pythonw.c b/Mac/OSX/pythonw.c new file mode 100644 index 0000000000..e70a76f846 --- /dev/null +++ b/Mac/OSX/pythonw.c @@ -0,0 +1,17 @@ +/* + * This wrapper program executes a python executable hidden inside an + * application bundle inside the Python framework. This is needed to run + * GUI code: some GUI API's don't work unless the program is inside an + * application bundle. + */ +#include <unistd.h> +#include <err.h> + +static char Python[] = PYTHONWEXECUTABLE; + +int main(int argc, char **argv) { + argv[0] = Python; + execv(Python, argv); + err(1, "execv: %s", Python); + /* NOTREACHED */ +} |
