mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
MacPython-2.3 has progressed so far that building a set of Mac 2.3
extensions on top of Python 2.2 no longer seems feasible.
This commit is contained in:
parent
a1b77584f2
commit
7b9a386ef9
3 changed files with 0 additions and 252 deletions
|
@ -1,105 +0,0 @@
|
||||||
# This Makefile, which should be run from the current directory, will build
|
|
||||||
# a MacPython based on the /usr/bin/python installed by Apple as of 10.2.
|
|
||||||
|
|
||||||
VERSION=2.2
|
|
||||||
|
|
||||||
builddir = ../..
|
|
||||||
srcdir = ../..
|
|
||||||
dstroot=/.
|
|
||||||
PYTHONAPPSPATH=/Applications/MacPython-OSX-$(VERSION)
|
|
||||||
PYTHONAPPSDIR=$(dstroot)$(PYTHONAPPSPATH)
|
|
||||||
prefix=/usr
|
|
||||||
|
|
||||||
# These are normally computed form the previous ones
|
|
||||||
osxdir=$(srcdir)/Mac/OSX
|
|
||||||
PYTHON=$(prefix)/bin/python
|
|
||||||
pythonw=$(prefix)/bin/pythonw
|
|
||||||
LIBDEST=$(prefix)/lib/python$(VERSION)
|
|
||||||
datadir=$(PYTHONAPPSDIR)/python-additions
|
|
||||||
MACLIBDEST=$(datadir)/Lib
|
|
||||||
MACDYNLIBDEST=$(datadir)/lib-dynload
|
|
||||||
MACTOOLSDEST=$(datadir)/Tools
|
|
||||||
APPNAME=Python
|
|
||||||
APPBUNDLENAME=$(APPNAME).app
|
|
||||||
INSTALLED_PYTHONW=$(datadir)/$(APPBUNDLENAME)/Contents/MacOS/$(APPNAME)
|
|
||||||
|
|
||||||
# The usual stuff
|
|
||||||
DIRMODE=755
|
|
||||||
INSTALL=/usr/bin/install -c
|
|
||||||
INSTALL_SYMLINK=ln -fs
|
|
||||||
INSTALL_PROGRAM=${INSTALL}
|
|
||||||
INSTALL_SCRIPT= ${INSTALL_PROGRAM}
|
|
||||||
INSTALL_DATA= ${INSTALL} -m 644
|
|
||||||
|
|
||||||
# These can be done as a normal user
|
|
||||||
install: preflight install_dirs install_dynlib install_lib \
|
|
||||||
install_Python install_IDE install_IDLE install_BuildApplet \
|
|
||||||
install_PythonLauncher install_pythonw
|
|
||||||
|
|
||||||
preflight:
|
|
||||||
@if test ! -w $(LIBDEST)/site-packages; then \
|
|
||||||
echo Please make directory $(LIBDEST)/site-packages writeable; \
|
|
||||||
exit 1; \
|
|
||||||
fi
|
|
||||||
@if grep "arch i386" $(LIBDEST)/config/Makefile >/dev/null; then \
|
|
||||||
echo Please edit $(LIBDEST)/config/Makefile, see README.JAGUAR; \
|
|
||||||
exit 1; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
install_dirs:
|
|
||||||
$(INSTALL) -d -m $(DIRMODE) $(PYTHONAPPSDIR)
|
|
||||||
$(INSTALL) -d -m $(DIRMODE) $(datadir)
|
|
||||||
$(INSTALL) -d -m $(DIRMODE) $(MACDYNLIBDEST)
|
|
||||||
|
|
||||||
install_lib: Mac.jaguar.pth
|
|
||||||
$(MAKE) -f $(osxdir)/Makefile installmacsubtree \
|
|
||||||
LIBDEST=$(LIBDEST) MACLIBDEST=$(MACLIBDEST) MACTOOLSDEST=$(MACTOOLSDEST) \
|
|
||||||
builddir=$(builddir) srcdir=$(srcdir) PTHFILE=Mac.jaguar.pth \
|
|
||||||
PYTHON=$(PYTHON) compileall=$(LIBDEST)/compileall.py
|
|
||||||
|
|
||||||
Mac.jaguar.pth:
|
|
||||||
echo $(MACLIBDEST) > Mac.jaguar.pth
|
|
||||||
echo $(MACDYNLIBDEST) >> Mac.jaguar.pth
|
|
||||||
## echo "import macresource; macresource.open_error_resource()" >> Mac.jaguar.pth
|
|
||||||
|
|
||||||
install_dynlib:
|
|
||||||
$(PYTHON) $(osxdir)/setup.jaguar.py install --install-lib=$(MACDYNLIBDEST)
|
|
||||||
touch $(MACDYNLIBDEST)/OverrideFrom23/__init__.py
|
|
||||||
|
|
||||||
install_Python:
|
|
||||||
$(PYTHON) $(srcdir)/Mac/Lib/bundlebuilder.py -q --link-exec \
|
|
||||||
-b $(datadir) \
|
|
||||||
-n $(APPBUNDLENAME) \
|
|
||||||
-r $(srcdir)/Mac/OSXResources/app/Resources/Applet-Info.plist \
|
|
||||||
-r $(srcdir)/Mac/OSXResources/app/Resources/PythonApplet.icns \
|
|
||||||
-e $(PYTHON) \
|
|
||||||
build
|
|
||||||
|
|
||||||
install_IDE:
|
|
||||||
$(MAKE) -f $(osxdir)/Makefile install_IDE \
|
|
||||||
srcdir=$(srcdir) INSTALLED_PYTHONW=$(INSTALLED_PYTHONW) \
|
|
||||||
PYTHONAPPSDIR=$(PYTHONAPPSDIR)
|
|
||||||
|
|
||||||
install_IDLE:
|
|
||||||
$(MAKE) -f $(osxdir)/Makefile install_IDLE \
|
|
||||||
srcdir=$(srcdir) INSTALLED_PYTHONW=$(INSTALLED_PYTHONW) \
|
|
||||||
PYTHONAPPSDIR=$(PYTHONAPPSDIR)
|
|
||||||
|
|
||||||
install_BuildApplet:
|
|
||||||
$(MAKE) -f $(osxdir)/Makefile install_BuildApplet \
|
|
||||||
srcdir=$(srcdir) INSTALLED_PYTHONW=$(INSTALLED_PYTHONW) \
|
|
||||||
PYTHONAPPSDIR=$(PYTHONAPPSDIR)
|
|
||||||
|
|
||||||
install_PythonLauncher:
|
|
||||||
$(MAKE) -f $(osxdir)/Makefile install_PythonLauncher \
|
|
||||||
srcdir=$(srcdir) dstroot=$(dstroot) \
|
|
||||||
PYTHONAPPSPATH=$(PYTHONAPPSPATH)
|
|
||||||
|
|
||||||
install_pythonw:
|
|
||||||
@if test ! -w $(prefix)/bin; then \
|
|
||||||
echo Cannot write to $(prefix)/bin, use \"sudo make -f Makefile.jaguar install_pythonw\"; \
|
|
||||||
exit 1; \
|
|
||||||
fi
|
|
||||||
echo "#!/bin/sh" > pythonw.sh
|
|
||||||
echo "exec \"$(INSTALLED_PYTHONW)\" \"\$$@\"" >> pythonw.sh
|
|
||||||
$(INSTALL) pythonw.sh $(prefix)/bin/pythonw
|
|
|
@ -1,62 +0,0 @@
|
||||||
Building a MacPython-OSX on top of Jaguar's /usr/bin/python
|
|
||||||
-----------------------------------------------------------
|
|
||||||
|
|
||||||
One way of getting MacPython functionality is to use the Python that Apple
|
|
||||||
supplies since MacOSX 10.2, and extend this with the missing bits.
|
|
||||||
|
|
||||||
(Another way is building a framework python, see Mac/OSX/README for
|
|
||||||
details on that).
|
|
||||||
|
|
||||||
Preparation
|
|
||||||
-----------
|
|
||||||
|
|
||||||
First of all you have to fix two things in the python distributed
|
|
||||||
by Apple. This paragraph is valid for 10.2 through 10.2.2, so if you
|
|
||||||
have a later version of Jaguar your mileage may vary.
|
|
||||||
|
|
||||||
1. /usr/lib/python2.2/config/Makefile has an erronuous reference to
|
|
||||||
building for intel processors. Edit the file with sudo, and change
|
|
||||||
the line
|
|
||||||
LDFLAGS= -arch i386 -arch ppc
|
|
||||||
to
|
|
||||||
LDFLAGS= -arch ppc
|
|
||||||
2. /usr/lib/python2.2/site-packages is not writeable except by root.
|
|
||||||
Make it writeable by administrators by doing
|
|
||||||
sudo chgrp admin /usr/lib/python2.2/site-packages
|
|
||||||
sudo chmod g+w /usr/lib/python2.2/site-packages
|
|
||||||
Alternatively you can do the make's below as superuser, but I
|
|
||||||
would advise against this.
|
|
||||||
|
|
||||||
Building
|
|
||||||
--------
|
|
||||||
|
|
||||||
Typing "make -f Makefile.jaguar" will build and install almost everything you need.
|
|
||||||
If you also want the "pythonw" unix program, which allows you to run GUI scripts from
|
|
||||||
a Terminal window, you should also do "sudo make -f Makefile.jaguar install_pythonw".
|
|
||||||
|
|
||||||
What do you get
|
|
||||||
---------------
|
|
||||||
|
|
||||||
After the make you will have a folder /Applications/MacPython-OSX that contains the
|
|
||||||
IDE and BuildApplet applications. Also, you will find a folder "python-additions" there
|
|
||||||
that contains the MacPython-specific additions to your installed Python. The only thing
|
|
||||||
that is installed outside the /Applications/MacPython-OSX folder is
|
|
||||||
/usr/lib/python2.2/site-packages/MacPython.pth, which is the magic file that will make
|
|
||||||
python find the new modules.
|
|
||||||
|
|
||||||
Uninstalling
|
|
||||||
------------
|
|
||||||
1. Remove /Applications/MacPython-OSX
|
|
||||||
2. Remove /usr/lib/python2.2/site-packages/MacPython.pth
|
|
||||||
|
|
||||||
How does it work?
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
Makefile.jaguar does most of the work by calling on Makefile (which is normally used
|
|
||||||
to build the Mac extensions for a framework-based python) after setting various
|
|
||||||
variables such that everything is built for /usr/bin/python. Some extension modules
|
|
||||||
(that are included in framework python 2.3a0, but missing from static python 2.2)
|
|
||||||
are built with setup.py. And some Carbon modules are built to replace their 2.2
|
|
||||||
versions, which lack required functionality. The stubs in Mac/Lib/Carbon know about
|
|
||||||
this overriding.
|
|
||||||
|
|
|
@ -1,85 +0,0 @@
|
||||||
from distutils.core import Extension, setup
|
|
||||||
from distutils import sysconfig
|
|
||||||
import os
|
|
||||||
|
|
||||||
SRCDIR="../.."
|
|
||||||
|
|
||||||
def find_file(filename, std_dirs, paths):
|
|
||||||
"""Searches for the directory where a given file is located,
|
|
||||||
and returns a possibly-empty list of additional directories, or None
|
|
||||||
if the file couldn't be found at all.
|
|
||||||
|
|
||||||
'filename' is the name of a file, such as readline.h or libcrypto.a.
|
|
||||||
'std_dirs' is the list of standard system directories; if the
|
|
||||||
file is found in one of them, no additional directives are needed.
|
|
||||||
'paths' is a list of additional locations to check; if the file is
|
|
||||||
found in one of them, the resulting list will contain the directory.
|
|
||||||
"""
|
|
||||||
|
|
||||||
# Check the standard locations
|
|
||||||
for dir in std_dirs:
|
|
||||||
f = os.path.join(dir, filename)
|
|
||||||
if os.path.exists(f): return []
|
|
||||||
|
|
||||||
# Check the additional directories
|
|
||||||
for dir in paths:
|
|
||||||
f = os.path.join(dir, filename)
|
|
||||||
if os.path.exists(f):
|
|
||||||
return [dir]
|
|
||||||
|
|
||||||
# Not found anywhere
|
|
||||||
return None
|
|
||||||
|
|
||||||
def find_library_file(compiler, libname, std_dirs, paths):
|
|
||||||
filename = compiler.library_filename(libname, lib_type='shared')
|
|
||||||
result = find_file(filename, std_dirs, paths)
|
|
||||||
if result is not None: return result
|
|
||||||
|
|
||||||
filename = compiler.library_filename(libname, lib_type='static')
|
|
||||||
result = find_file(filename, std_dirs, paths)
|
|
||||||
return result
|
|
||||||
|
|
||||||
def waste_Extension():
|
|
||||||
waste_incs = find_file("WASTE.h", [],
|
|
||||||
['../'*n + 'waste/C_C++ Headers' for n in (0,1,2,3,4)])
|
|
||||||
if waste_incs != None:
|
|
||||||
waste_libs = [os.path.join(os.path.split(waste_incs[0])[0], "Static Libraries")]
|
|
||||||
srcdir = SRCDIR
|
|
||||||
return [ Extension('waste',
|
|
||||||
[os.path.join(srcdir, d) for d in
|
|
||||||
'Mac/Modules/waste/wastemodule.c',
|
|
||||||
'Mac/Wastemods/WEObjectHandlers.c',
|
|
||||||
'Mac/Wastemods/WETabHooks.c',
|
|
||||||
'Mac/Wastemods/WETabs.c'
|
|
||||||
],
|
|
||||||
include_dirs = waste_incs + [
|
|
||||||
os.path.join(srcdir, 'Mac/Include'),
|
|
||||||
os.path.join(srcdir, 'Mac/Wastemods')
|
|
||||||
],
|
|
||||||
library_dirs = waste_libs,
|
|
||||||
libraries = ['WASTE'],
|
|
||||||
extra_link_args = ['-framework', 'Carbon'],
|
|
||||||
) ]
|
|
||||||
return []
|
|
||||||
|
|
||||||
setup(name="MacPython for Jaguar extensions", version="2.2",
|
|
||||||
ext_modules=[
|
|
||||||
Extension("OverrideFrom23._AE",
|
|
||||||
[SRCDIR + "/Mac/Modules/ae/_AEmodule.c"],
|
|
||||||
include_dirs=[SRCDIR+"/Mac/Include"],
|
|
||||||
extra_link_args=['-framework', 'Carbon']),
|
|
||||||
Extension("OverrideFrom23._Res",
|
|
||||||
[SRCDIR + "/Mac/Modules/res/_Resmodule.c"],
|
|
||||||
include_dirs=[SRCDIR+"/Mac/Include"],
|
|
||||||
extra_link_args=['-framework', 'Carbon']),
|
|
||||||
Extension('_Help',
|
|
||||||
[SRCDIR + '/Mac/Modules/help/_Helpmodule.c'],
|
|
||||||
include_dirs=[SRCDIR+"/Mac/Include"],
|
|
||||||
extra_link_args=['-framework', 'Carbon']),
|
|
||||||
Extension('_Scrap',
|
|
||||||
[SRCDIR + '/Mac/Modules/scrap/_Scrapmodule.c'],
|
|
||||||
include_dirs=[SRCDIR+"/Mac/Include"],
|
|
||||||
extra_link_args=['-framework', 'Carbon']),
|
|
||||||
] +
|
|
||||||
waste_Extension()
|
|
||||||
)
|
|
Loading…
Add table
Add a link
Reference in a new issue