[Python-checkins] python/dist/src/Mac/OSX Makefile.tiger, NONE, 1.1.2.1 setup.tiger.py, NONE, 1.1.2.1

jackjansen at users.sourceforge.net jackjansen at users.sourceforge.net
Sat Apr 23 00:38:15 CEST 2005


Update of /cvsroot/python/python/dist/src/Mac/OSX
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20364

Added Files:
      Tag: release23-maint
	Makefile.tiger setup.tiger.py 
Log Message:
Started on MacPython additions for Tiger.


--- NEW FILE: Makefile.tiger ---
# This Makefile is to be used *only* on Tiger.
# It installs the things that are available in MacPython but that are
# ommitted from Apple's installation of Python 2.3.5.
#
all: install_waste install_IDE install_PackageManager \
	install_BuildApplet installextras install_PythonLauncher

srcdir=../..
VERSION=2.3
DESTDIR=
PYTHONAPPSDIR=/Applications/MacPython-$(VERSION)

APPLE_prefix=/System/Library/Frameworks/Python.framework/Versions/$(VERSION)
BUILDPYTHON=/usr/bin/python$(VERSION)
APPLE_LIBDEST=$(APPLE_prefix)/lib/python$(VERSION)
INSTALLED_PYTHONW=$(APPLE_prefix)/Resources/Python.app/Contents/MacOS/Python
APPLE_PYTHONLAUNCHER=$(APPLE_prefix)/Resources/PythonLauncher.app
bundlebuilder=$(srcdir)/Lib/plat-mac/bundlebuilder.py

install_waste:
	$(BUILDPYTHON) setup.panther.py install \
		--prefix=$(APPLE_prefix) --root=/$(DESTDIR)
	
install_IDE:
	$(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \
		--python $(INSTALLED_PYTHONW) \
		--output $(DESTDIR)$(PYTHONAPPSDIR)/PythonIDE.app --noargv \
		$(srcdir)/Mac/Tools/IDE/PythonIDE.py
#	# Add the extra files to the resources. This is to work around bugs in
#	# them in the original 2.3.
#	cp ../Tools/IDE/PythonIDEMain.py $(DESTDIR)$(PYTHONAPPSDIR)/PythonIDE.app/Contents/Resources
#	cp ../Tools/IDE/Wapplication.py $(DESTDIR)$(PYTHONAPPSDIR)/PythonIDE.app/Contents/Resources
#	cp ../Tools/IDE/Wcontrols.py $(DESTDIR)$(PYTHONAPPSDIR)/PythonIDE.app/Contents/Resources
#	cp ../Tools/IDE/PyEdit.py $(DESTDIR)$(PYTHONAPPSDIR)/PythonIDE.app/Contents/Resources

install_PackageManager:
	$(BUILDPYTHON) $(bundlebuilder) \
		--builddir $(DESTDIR)$(PYTHONAPPSDIR)/ \
		--python $(INSTALLED_PYTHONW) \
		--resource $(srcdir)/Mac/Tools/IDE/PythonIDE.rsrc \
		--mainprogram $(srcdir)/Mac/Tools/IDE/PackageManager.py \
		--iconfile $(srcdir)/Mac/Tools/IDE/PackageManager.icns \
		--plist $(srcdir)/Mac/Tools/IDE/PackageManager.plist \
		--creator Pimp build

install_BuildApplet:
	$(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \
		--python $(INSTALLED_PYTHONW) \
		--output $(DESTDIR)$(PYTHONAPPSDIR)/BuildApplet.app \
		$(srcdir)/Mac/scripts/BuildApplet.py

installextras:
	$(MAKE) -f Makefile installextras \
		BUILDPYTHON=$(BUILDPYTHON) INSTALLED_PYTHONW=$(INSTALLED_PYTHONW) \
		DESTDIR=$(DESTDIR) PYTHONAPPSDIR=$(PYTHONAPPSDIR)

install_PythonLauncher:
	ln -fsn $(APPLE_PYTHONLAUNCHER) $(DESTDIR)$(PYTHONAPPSDIR)/PythonLauncher
	
install_pimpupdate:
	cp ../../Lib/plat-mac/pimp.py $(DESTDIR)/Library/Python/2.3/pimp_update.py
    

--- NEW FILE: setup.tiger.py ---
from distutils.core import Extension, setup
from distutils import sysconfig
import os

SRCDIR=os.path.realpath(os.path.join(os.getcwd(), "../.."))

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 Tiger extensions", version="2.3",
    ext_modules=waste_Extension()
    )


More information about the Python-checkins mailing list