summaryrefslogtreecommitdiff
path: root/Mac/IDLE
diff options
context:
space:
mode:
authorRonald Oussoren <ronaldoussoren@mac.com>2009-12-24 13:30:58 +0000
committerRonald Oussoren <ronaldoussoren@mac.com>2009-12-24 13:30:58 +0000
commit326127b24ce399aacec3c90307d0abbeb35ee1c9 (patch)
tree75e4e854f6acdf51e27ef6beed49b635ee5837dc /Mac/IDLE
parent3811226d1c6f33214723c1936d68abd2df83fb9f (diff)
downloadcpython-326127b24ce399aacec3c90307d0abbeb35ee1c9.tar.gz
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.
Diffstat (limited to 'Mac/IDLE')
-rw-r--r--Mac/IDLE/Info.plist.in9
-rw-r--r--Mac/IDLE/Makefile.in9
-rw-r--r--Mac/IDLE/idlemain.py4
3 files changed, 19 insertions, 3 deletions
diff --git a/Mac/IDLE/Info.plist.in b/Mac/IDLE/Info.plist.in
index 58e913c569..1da402c9c6 100644
--- a/Mac/IDLE/Info.plist.in
+++ b/Mac/IDLE/Info.plist.in
@@ -51,5 +51,14 @@
<string>%VERSION%</string>
<key>CFBundleVersion</key>
<string>%VERSION%</string>
+<!--
+ <key>LSMinimumSystemVersionByArchitecture</key>
+ <dict>
+ <key>x86_64</key>
+ <string>10.6.0</string>
+ <key>ppc64</key>
+ <string>10.6.0</string>
+ </dict>
+-->
</dict>
</plist>
diff --git a/Mac/IDLE/Makefile.in b/Mac/IDLE/Makefile.in
index 496c139e72..54468649c0 100644
--- a/Mac/IDLE/Makefile.in
+++ b/Mac/IDLE/Makefile.in
@@ -10,6 +10,8 @@ VERSION= @VERSION@
UNIVERSALSDK=@UNIVERSALSDK@
builddir= ../..
PYTHONFRAMEWORK=@PYTHONFRAMEWORK@
+LIPO_32BIT_FLAGS=@LIPO_32BIT_FLAGS@
+
RUNSHARED= @RUNSHARED@
BUILDEXE= @BUILDEXEEXT@
@@ -51,9 +53,12 @@ IDLE.app: \
--iconfile=$(srcdir)/../Icons/IDLE.icns \
--resource=$(srcdir)/../Icons/PythonSource.icns \
--resource=$(srcdir)/../Icons/PythonCompiled.icns \
- --python=$(prefix)/Resources/Python.app/Contents/MacOS/$(PYTHONFRAMEWORK)`test -f "$(DESTDIR)$(prefix)/Resources/Python.app/Contents/MacOS/$(PYTHONFRAMEWORK)-32" && echo "-32"` \
+ --python=$(prefix)/Resources/Python.app/Contents/MacOS/Python \
build
-
+ifneq ($(LIPO_32BIT_FLAGS),)
+ rm "IDLE.app/Contents/MacOS/Python"
+ lipo $(LIPO_32BIT_FLAGS) -output "IDLE.app/Contents/MacOS/Python" "$(BUILDPYTHON)"
+endif
Info.plist: $(srcdir)/Info.plist.in
sed 's/%VERSION%/'"`$(RUNSHARED) $(BUILDPYTHON) -c 'import platform; print platform.python_version()'`"'/g' < $(srcdir)/Info.plist.in > Info.plist
diff --git a/Mac/IDLE/idlemain.py b/Mac/IDLE/idlemain.py
index d6803ba832..8b8beb93d0 100644
--- a/Mac/IDLE/idlemain.py
+++ b/Mac/IDLE/idlemain.py
@@ -48,7 +48,7 @@ os.chdir(os.path.expanduser('~/Documents'))
# the interpreter in the framework, by following the symlink
# exported in PYTHONEXECUTABLE.
pyex = os.environ['PYTHONEXECUTABLE']
-sys.executable = os.path.join(os.path.dirname(pyex), os.readlink(pyex))
+sys.executable = os.path.join(sys.prefix, 'bin', 'python%d.%d'%(sys.version_info[:2]))
# Remove any sys.path entries for the Resources dir in the IDLE.app bundle.
p = pyex.partition('.app')
@@ -68,6 +68,8 @@ for idx, value in enumerate(sys.argv):
break
# Now it is safe to import idlelib.
+from idlelib import macosxSupport
+macosxSupport._appbundle = True
from idlelib.PyShell import main
if __name__ == '__main__':
main()