[Pythonmac-SIG] Later release of Python with MacPython on Jaguar?
Brian Lenihan
brian_l at mac.com
Tue Dec 9 16:52:44 EST 2003
On Dec 9, 2003, at 12:55 PM, Gary Robinson wrote:
> Is it possible/good/recommended to build a later release like Python
> 2.3.2
> or 2.3.3RC1 on Jaguar to replace the MacPython-supplied python with it?
>
> Are their known problems with doing so?
>
> We're seeing some behavior that is mysterious enough that we currently
> think
> it might be a bug in python. We're wondering if it would clear up with
> a
> later python release than the MacPython-supplied one.
>
> --Gary
You are probably better off leaving Apple's Python alone. I just
rename
everything so I can put it back later. I wrote a script modeled after
gcc_select
to make it easy to switch back and forth.
I have Jack's additions for Apple Python installed, which, if I remember
correctly, added a MacPython-2.3 folder in Applications.
Before this script is run, you must rename the files and folders in
either the
ApplePython or MacPython tuples by hand, e.g:
/System/Library/Frameworks/Python.framework ->
/System/Library/Frameworks/Python.framework-moved
/usr/bin/python -> /usr/bin/python-moved
/usr/bin/python2.3 -> /usr/bin/python2.3-moved
/usr/bin/pythonw - > /usr/bin/pythonw-moved
/usr/bin/pythonw2.3 -> /usr/bin/pythonw2.3-moved
/usr/bin/pydoc -> /usr/bin/pydoc-moved
And, if you have a MacPython-2.3 folder in /Applications:
/Applications/MacPython-2.3 -> /Applications/MacPython-2.3-Apple
py_select
--------------
#!/usr/bin/env python
import os
import sys
current_ver = "2.3"
python_apps = "/Applications/MacPython-%s" % current_ver
MacPython = ("/Library/Frameworks/Python.framework",
"/usr/local/bin/python",
"/usr/local/bin/python%s" % current_ver,
"/usr/local/bin/pythonw",
"/usr/local/bin/pythonw%s" % current_ver
)
ApplePython = ("/System/Library/Frameworks/Python.framework",
"/usr/bin/python",
"/usr/bin/python%s" % current_ver,
"/usr/bin/pythonw",
"/usr/bin/pythonw%s" % current_ver,
"/usr/bin/pydoc"
)
def select_python(version, not_version):
py_path = eval(version + "Python")[1]
if os.path.exists(py_path):
print "You are already using %sPython" % version
sys.exit()
elif os.geteuid() != 0:
print """\
*******************************************
*** THE py_select SCRIPT MUST BE RUN ***
*** AS root. ***
*** NO CHANGES WERE MADE TO YOUR SETUP. ***
*******************************************
""",
sys.exit()
for dir in eval(version + "Python"):
os.rename("%s-moved" % dir, dir)
for dir in eval(not_version + "Python"):
os.rename(dir, "%s-moved" % dir)
os.rename(python_apps, "%s-%s" % (python_apps, not_version))
os.rename("%s-%s" % (python_apps, version), python_apps)
print "Default Python interpreter has been set to:"
os.system("%s -c 'import sys; print sys.version'" % py_path)
if len(sys.argv) == 1:
print "Current default Python interpreter:"
print sys.version
elif sys.argv[1].lower() == 'apple':
select_python('Apple', 'Mac')
elif sys.argv[1].lower() == 'mac':
select_python('Mac', 'Apple')
else:
print "usage: %s <apple|mac>" % sys.argv[0]
#----
More information about the Pythonmac-SIG
mailing list