summaryrefslogtreecommitdiffstats
path: root/Mac/IDLE
diff options
context:
space:
mode:
authorRonald Oussoren <ronaldoussoren@mac.com>2009-12-24 13:30:58 (GMT)
committerRonald Oussoren <ronaldoussoren@mac.com>2009-12-24 13:30:58 (GMT)
commit92919a66d2bd4641a83edff4356805280d77a068 (patch)
treeb3a14baded017d5a0b02eb871dc1bd808b6bdf24 /Mac/IDLE
parent1a13cff7a59a1301a220d721088cb98f2feec7ad (diff)
downloadcpython-92919a66d2bd4641a83edff4356805280d77a068.zip
cpython-92919a66d2bd4641a83edff4356805280d77a068.tar.gz
cpython-92919a66d2bd4641a83edff4356805280d77a068.tar.bz2
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 58e913c..1da402c 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 496c139..5446864 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 d6803ba..8b8beb9 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()