Commits

Anonymous committed d055f94

Started on MacPython additions for Tiger.

Comments (0)

Files changed (5)

Mac/OSX/Dist/build.tiger

+#!/bin/sh -e
+#----------------------------------------------------------------------
+# Build the MacPython 2.3 extensions for an installation to run
+# on the pre-installed 2.3.5 framework build on OSX 10.4
+
+# TODO:  Parameterize the versions, builddirs, etc...
+
+# Script configs
+PYVERSION=2.3.5
+PYVER=2.3
+BUILDNUM=1
+DOCLEANUP=no
+
+PROGDIR="`dirname \"$0\"`"
+case x$PROGDIR in
+x|x.) PROGDIR=`pwd` ;;
+x/*) ;;
+*) echo "Please run with a full pathname"
+   exit 1
+   ;;
+esac
+
+if [ ! -e /usr/bin/python ]; then
+	echo "No /usr/bin/python; this script expects to be run on 10.4 only"
+	exit 1
+fi
+vers=`/usr/bin/python -V 2>&1`
+if [ "$vers" != "Python 2.3.5" ]; then
+    echo "/usr/bin/python is not version 2.3.5; this script expects to be run on 10.3 only"
+    exit 1
+fi
+
+TMPDIR=/tmp/_py
+#TMPDIR=/projects/_py
+
+INSTALLROOT=$TMPDIR/install
+DMGDIR=$TMPDIR/dmg
+RESOURCEDIR=$PROGDIR/resources.tiger
+DESTDIR=$TMPDIR/dist
+PYTHONSRC=$PROGDIR/../../..
+PYTHONOSXDIR=$PYTHONSRC/Mac/OSX
+WASTEDIR=$PYTHONSRC/../waste
+
+rm -rf $DMGDIR
+if [ ! -e $TMPDIR ]; then
+	mkdir $TMPDIR
+fi
+chgrp admin $TMPDIR
+mkdir -p $DMGDIR/root
+
+
+# Ask the user whether s/he has edited Welcome.txt
+read -p "Have you updated $RESOURCEDIR/Welcome.txt (Y/n)? " welcome
+
+if [ "$welcome" = "n" -o "$welcome" = "N" ]; then
+	echo "Please do so and retry"
+	exit
+fi
+
+# Make the installation directories
+mkdir -p $INSTALLROOT/Applications
+mkdir -p $INSTALLROOT/Library/Python/$PYVER
+
+# Make a temporary site-packages symlink
+mkdir -p $INSTALLROOT/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/
+ln -s $INSTALLROOT/Library/Python/$PYVER $INSTALLROOT/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages
+
+pushd $PYTHONOSXDIR
+
+make -f Makefile.tiger DIRMODE=775 EXEMODE=775 FILEMODE=664 DESTDIR=$INSTALLROOT
+
+# Remove the temporary symlink
+rm -r $INSTALLROOT/System
+
+# Unfortunately all the ...MODE arguments above still don't do the trick.
+# Cop out, and recursively set everything group-writeable.
+chmod -R ug+w $INSTALLROOT
+
+popd
+
+# Make the Installer package:
+
+# Finally, build the package...
+rm -rf MacPython-Tiger.pkg
+python $PYTHONSRC/Mac/scripts/buildpkg.py \
+    --Title=MacPython-Tiger \
+    --Version=$PYVERSION-$BUILDNUM \
+    --Description="MacPython $PYVERSION tools and additions for Mac OS X 10.4" \
+    --NeedsAuthorization="YES" \
+    --Relocatable="NO" \
+    --InstallOnly="YES" \
+    --UseUserMask="NO" \
+    $INSTALLROOT \
+    $RESOURCEDIR
+
+#    --RootVolumeOnly="YES" \
+
+# ...and then make a disk image containing the package.
+mv MacPython-Tiger.pkg $DMGDIR/root
+cp $RESOURCEDIR/ReadMe.txt $DMGDIR/root/ReadMe.txt
+$PROGDIR/makedmg $DMGDIR/root $DMGDIR MacPython-Tiger-$PYVERSION-$BUILDNUM
+
+echo Moving $DMGDIR/MacPython-Tiger-$PYVERSION-$BUILDNUM to $DESTDIR
+if [ ! -e $DESTDIR ]; then
+    mkdir $DESTDIR
+fi
+mv $DMGDIR/MacPython-Tiger-$PYVERSION-$BUILDNUM.dmg $DESTDIR
+
+
+# Cleanup build/install dirs
+if [ $DOCLEANUP = yes ]; then
+    echo "Cleaning up..."
+    rm -rf $INSTALLROOT
+    rm -rf $DMGDIR
+else
+    echo "Cleanup is disabled.  You should remove these dirs when done:"
+    echo "          $INSTALLROOT"
+    echo "          $DMGDIR"
+fi
+echo "Your installer can be found in $DESTDIR"
+

Mac/OSX/Dist/resources.tiger/ReadMe.txt

+This package will install the MacPython 2.3.5 additions
+for Mac OS X 10.4. 
+
+Installation requires approximately 3.3 MB of disk
+space, ignore the message that it will take zero bytes.
+
+You must install onto your current boot disk, even
+though the installer does not enforce this, otherwise
+things will not work.
+
+This installer does not contain a Python engine, as
+Apple already includes that in 10.4. It does contain
+a set of programs to allow easy access to it for Mac 
+users (an integrated development environment, a Python 
+extension package manager) and the waste module. 
+
+The installer puts the applications in MacPython-2.3 in
+your Applications folder.
+
+The PythonIDE application has a Help command that gets
+you started quickly with MacPython and contains
+references to other documentation.
+
+More information on MacPython can be found at
+http://www.cwi.nl/~jack/macpython, more
+information on Python in general at
+http://www.python.org.

Mac/OSX/Dist/resources.tiger/Welcome.rtf

Binary file added.
+{\rtf1\mac\ansicpg10000\cocoartf822
+{\fonttbl\f0\fswiss\fcharset77 Helvetica;\f1\fswiss\fcharset77 Helvetica-Bold;}
+{\colortbl;\red255\green255\blue255;}
+\paperw11900\paperh16840\margl1440\margr1440\vieww9920\viewh10660\viewkind0
+\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural
+
+\f0\fs24 \cf0 This package will install the third build of the 
+\f1\b MacPython 2.3.5
+\f0\b0  additions for 
+\f1\b Mac OS X 10.4
+\f0\b0 . \
+\
+MacPython consists of the programs to allow easy access to Python for Mac users (an integrated development environment, a Python extension package manager), and uses the Python 2.3.5 interpreter core that comes pre-installed on 10.4.\
+\
+See the ReadMe file for more information.}

Mac/OSX/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
+    

Mac/OSX/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()
+    )