Merged revisions 77031 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77031 | ronald.oussoren | 2009-12-24 14:30:58 +0100 (Thu, 24 Dec 2009) | 15 lines

  Issue #6834: replace the implementation for the 'python' and 'pythonw' executables on OSX.

  The previous implementation used execv(2) to run the real interpreter, which means that
  you cannot use the arch(1) tool to select the architecture you want to use for a
  universal build because that only affects the python/pythonw wrapper and not the actual
  interpreter.

  The new version uses posix_spawnv with a number of OSX-specific options that ensure that
  the real interpreter is started using the same CPU architecture as the wrapper, and that
  means that 'arch -ppc python' now actually works.

  I've also changed the way that the wrapper looks for the framework: it is now linked to
  the framework rather than hardcoding the framework path. This should make it easier to
  provide pythonw support in tools like virtualenv.
........
diff --git a/Mac/Makefile.in b/Mac/Makefile.in
index 15531d8..b1d4456 100644
--- a/Mac/Makefile.in
+++ b/Mac/Makefile.in
@@ -15,6 +15,7 @@
 FRAMEWORKUNIXTOOLSPREFIX=@FRAMEWORKUNIXTOOLSPREFIX@
 PYTHONFRAMEWORK=@PYTHONFRAMEWORK@
 PYTHONFRAMEWORKIDENTIFIER=@PYTHONFRAMEWORKIDENTIFIER@
+LIPO_32BIT_FLAGS=@LIPO_32BIT_FLAGS@
 
 
 # These are normally glimpsed from the previous set
@@ -41,11 +42,8 @@
 APPSUBDIRS=MacOS Resources 
 compileall=$(srcdir)/../Lib/compileall.py
 
-installapps: install_Python install_PythonLauncher install_IDLE \
-	checkapplepython install_pythonw install_versionedtools
-
-installapps4way: install_Python4way install_PythonLauncher \
-	install_IDLE4way install_pythonw4way install_versionedtools
+installapps: install_Python install_pythonw install_PythonLauncher install_IDLE \
+	checkapplepython install_versionedtools
 
 
 install_pythonw: pythonw
@@ -53,33 +51,12 @@
 	$(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/python$(VERSION)"
 	ln -sf python$(VERSION) "$(DESTDIR)$(prefix)/bin/python3"
 	ln -sf pythonw$(VERSION) "$(DESTDIR)$(prefix)/bin/pythonw3"
-
-
-# Install 3 variants of python/pythonw: 
-# 	- 32-bit (i386 and ppc)
-# 	- 64-bit (x86_64 and ppc64)
-# 	- all    (all four architectures)
-# 	- Make 'python' and 'pythonw' aliases for the 32-bit variant
-install_pythonw4way: pythonw-32 pythonw-64 pythonw
-	$(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-64 "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-64"
-	$(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-64 "$(DESTDIR)$(prefix)/bin/python$(VERSION)-64"
-	ln -sf python$(VERSION)-64 "$(DESTDIR)$(prefix)/bin/python3-64"
-	ln -sf pythonw$(VERSION)-64 "$(DESTDIR)$(prefix)/bin/pythonw3-64"
-
-	$(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-32 "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-32"
-	$(INSTALL_PROGRAM) $(STRIPFLAG) pythonw-32 "$(DESTDIR)$(prefix)/bin/python$(VERSION)-32"
-	ln -sf python$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/python3-32"
-	ln -sf pythonw$(VERSION)-32 "$(DESTDIR)$(prefix)/bin/pythonw3-32"
-
-	$(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-all"
-	$(INSTALL_PROGRAM) $(STRIPFLAG) pythonw "$(DESTDIR)$(prefix)/bin/python$(VERSION)-all"
-	ln -sf python$(VERSION)-all "$(DESTDIR)$(prefix)/bin/python3-all"
-	ln -sf pythonw$(VERSION)-all "$(DESTDIR)$(prefix)/bin/pythonw3-all"
-
+ifneq ($(LIPO_32BIT_FLAGS),)
+	lipo $(LIPO_32BIT_FLAGS) -output $(DESTDIR)$(prefix)/bin/python$(VERSION)-32 pythonw
+	lipo $(LIPO_32BIT_FLAGS) -output $(DESTDIR)$(prefix)/bin/pythonw$(VERSION)-32 pythonw
 	ln -sf pythonw$(VERSION)-32	"$(DESTDIR)$(prefix)/bin/pythonw$(VERSION)"
 	ln -sf python$(VERSION)-32	"$(DESTDIR)$(prefix)/bin/python$(VERSION)"
-	ln -sf pythonw$(VERSION)-32	"$(DESTDIR)$(prefix)/bin/pythonw3"
-	ln -sf python$(VERSION)-32	"$(DESTDIR)$(prefix)/bin/python3"
+endif
 
 #
 # Install unix tools in /usr/local/bin. These are just aliases for the 
@@ -98,10 +75,6 @@
 	done
 
 
-# TODO: install symlinks for -32, -64 and -all as well
-installunixtools4way: installunixtools
-
-
 #
 # Like installunixtools, but only install links to the versioned binaries.
 #
@@ -115,9 +88,6 @@
 		ln -fs "$(prefix)/bin/$${fn}" "$(DESTDIR)$(FRAMEWORKUNIXTOOLSPREFIX)/bin/$${fn}" ;\
 	done
 
-# TODO: -32, -64 and -all variants
-altinstallunixtools4way: altinstallunixtools
-
 # 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
@@ -140,16 +110,7 @@
 
 
 pythonw: $(srcdir)/Tools/pythonw.c Makefile
-	$(CC) $(LDFLAGS) -o $@ $(srcdir)/Tools/pythonw.c \
-		-DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"'
-
-pythonw-32: $(srcdir)/Tools/pythonw.c Makefile
-	$(CC) $(LDFLAGS) -o $@ -arch i386 -arch ppc $(srcdir)/Tools/pythonw.c \
-		-DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-32"'
-
-pythonw-64: $(srcdir)/Tools/pythonw.c Makefile
-	$(CC) $(LDFLAGS) -o $@ -arch x86_64 -arch ppc64 $(srcdir)/Tools/pythonw.c \
-		-DPYTHONWEXECUTABLE='"$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-64"'
+	$(CC) $(LDFLAGS) -o $@ $(srcdir)/Tools/pythonw.c -I.. -I$(srcdir)/../Include ../$(PYTHONFRAMEWORK).framework/Versions/$(VERSION)/$(PYTHONFRAMEWORK)
 
 install_PythonLauncher:
 	cd PythonLauncher && make install DESTDIR=$(DESTDIR)
@@ -205,11 +166,6 @@
 		> "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist"
 	rm "$(DESTDIR)$(APPINSTALLDIR)/Contents/Info.plist.in"
 
-install_Python4way: install_Python
-	lipo  -extract i386 -extract ppc7400 -output "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-32" "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"
-	lipo  -extract x86_64 -extract ppc64 -output "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)-64" "$(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/$(PYTHONFRAMEWORK)"
-
-
 
 install_IDLE:
 	test -d "$(DESTDIR)$(PYTHONAPPSDIR)" || mkdir -p "$(DESTDIR)$(PYTHONAPPSDIR)"
@@ -237,11 +193,6 @@
 	fi
 	touch "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app"
 
-install_IDLE4way: install_IDLE
-	ln -sf "$(INSTALLED_PYTHONAPP)-32" "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app/Contents/MacOS/Python"
-	sed -e "s!%prefix%!$(prefix)!g" -e 's!%exe%!$(PYTHONFRAMEWORK)-32!g' < "$(srcdir)/IDLE/IDLE.app/Contents/MacOS/IDLE" > "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app/Contents/MacOS/IDLE"
-	touch "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app"
-
 $(INSTALLED_PYTHONAPP): install_Python
 
 installextras: $(srcdir)/Extras.ReadMe.txt $(srcdir)/Extras.install.py