summaryrefslogtreecommitdiffstats
path: root/Mac/Tools
diff options
context:
space:
mode:
authorNed Deily <nad@acm.org>2012-06-24 07:19:31 (GMT)
committerNed Deily <nad@acm.org>2012-06-24 07:19:31 (GMT)
commit430d7a3090389606c2c9370d854a08eacc7f6823 (patch)
tree3abed9bb6c9129c887430e8f324008a24f59fcc9 /Mac/Tools
parent7d9cf83f2fe3f3db06b6b34bca186e45bb940128 (diff)
downloadcpython-430d7a3090389606c2c9370d854a08eacc7f6823.zip
cpython-430d7a3090389606c2c9370d854a08eacc7f6823.tar.gz
cpython-430d7a3090389606c2c9370d854a08eacc7f6823.tar.bz2
Remove obsolete fixapplepython23 script and PythonSystemFixes
installer package from the OS X Makefile for Python 3. It has never worked on Python 3 and is not needed there as pre-10.3.9 installs are no longer supported.
Diffstat (limited to 'Mac/Tools')
-rw-r--r--Mac/Tools/fixapplepython23.py131
1 files changed, 0 insertions, 131 deletions
diff --git a/Mac/Tools/fixapplepython23.py b/Mac/Tools/fixapplepython23.py
deleted file mode 100644
index 18b95b3..0000000
--- a/Mac/Tools/fixapplepython23.py
+++ /dev/null
@@ -1,131 +0,0 @@
-#!/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
-for a framework installation may accidentally pick up the framework
-of a newer Python, in stead of the one that was used to build the extension.
-
-This script modifies the Makefile (in .../lib/python2.3/config) to use
-the newer method of linking extensions with "-undefined dynamic_lookup"
-which fixes this problem.
-
-The script will first check all prerequisites, and return a zero exit
-status also when nothing needs to be fixed.
-"""
-import sys
-import os
-import platform
-
-MAKEFILE='/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/config/Makefile'
-CHANGES=((
- 'LDSHARED=\t$(CC) $(LDFLAGS) -bundle -framework $(PYTHONFRAMEWORK)\n',
- 'LDSHARED=\t$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup\n'
- ),(
- 'BLDSHARED=\t$(CC) $(LDFLAGS) -bundle -framework $(PYTHONFRAMEWORK)\n',
- 'BLDSHARED=\t$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup\n'
- ),(
- 'CC=\t\tgcc\n',
- 'CC=\t\t/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/config/PantherPythonFix/run-gcc\n'
- ),(
- 'CXX=\t\tc++\n',
- 'CXX=\t\t/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/config/PantherPythonFix/run-g++\n'
-))
-
-GCC_SCRIPT='/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/config/PantherPythonFix/run-gcc'
-GXX_SCRIPT='/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/config/PantherPythonFix/run-g++'
-SCRIPT="""#!/bin/sh
-export MACOSX_DEPLOYMENT_TARGET=10.3
-exec %s "${@}"
-"""
-
-def findline(lines, start):
- """return line starting with given string or -1"""
- for i in range(len(lines)):
- if lines[i][:len(start)] == start:
- return i
- return -1
-
-def fix(makefile, do_apply):
- """Fix the Makefile, if required."""
- fixed = False
- lines = open(makefile).readlines()
-
- for old, new in CHANGES:
- i = findline(lines, new)
- if i >= 0:
- # Already fixed
- continue
- i = findline(lines, old)
- if i < 0:
- print('fixapplepython23: Python installation not fixed (appears broken)')
- print('fixapplepython23: missing line:', old)
- return 2
- lines[i] = new
- fixed = True
-
- if fixed:
- if do_apply:
- print('fixapplepython23: Fix to Apple-installed Python 2.3 applied')
- os.rename(makefile, makefile + '~')
- open(makefile, 'w').writelines(lines)
- return 0
- else:
- print('fixapplepython23: Fix to Apple-installed Python 2.3 should be applied')
- return 1
- else:
- print('fixapplepython23: No fix needed, appears to have been applied before')
- return 0
-
-def makescript(filename, compiler):
- """Create a wrapper script for a compiler"""
- dirname = os.path.split(filename)[0]
- if not os.access(dirname, os.X_OK):
- os.mkdir(dirname, 0o755)
- fp = open(filename, 'w')
- fp.write(SCRIPT % compiler)
- fp.close()
- os.chmod(filename, 0o755)
- print('fixapplepython23: Created', filename)
-
-def main():
- # Check for -n option
- if len(sys.argv) > 1 and sys.argv[1] == '-n':
- do_apply = False
- 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)
-
- osver = platform.mac_ver()
- if osver != '10.3' and os.ver < '10.3.':
- print('fixapplepython23: no fix needed on MacOSX < 10.3')
- sys.exit(0)
-
- if osver >= '10.4':
- 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')
- sys.exit(0)
- # Check that we can actually write the file
- if do_apply and not os.access(MAKEFILE, os.W_OK):
- print('fixapplepython23: No write permission, please run with "sudo"')
- sys.exit(2)
- # Create the shell scripts
- if do_apply:
- if not os.access(GCC_SCRIPT, os.X_OK):
- makescript(GCC_SCRIPT, "gcc")
- if not os.access(GXX_SCRIPT, os.X_OK):
- makescript(GXX_SCRIPT, "g++")
- # Finally fix the makefile
- rv = fix(MAKEFILE, do_apply)
- #sys.exit(rv)
- sys.exit(0)
-
-if __name__ == '__main__':
- main()