Move Mac/OSX/* one level up
|
@ -3,25 +3,23 @@
|
|||
# commandline in that case.
|
||||
|
||||
VERSION=@VERSION@
|
||||
builddir = ../..
|
||||
srcdir = @srcdir@
|
||||
builddir = ..
|
||||
srcdir=@srcdir@
|
||||
prefix=/Library/Frameworks/Python.framework/Versions/$(VERSION)
|
||||
LIBDEST=$(prefix)/lib/python$(VERSION)
|
||||
BUILDPYTHON=$(builddir)/python.exe
|
||||
RUNSHARED=@RUNSHARED@
|
||||
BUILDEXE=@BUILDEXEEXT@
|
||||
BUILDPYTHON=$(builddir)/python$(BUILDEXE)
|
||||
DESTDIR=
|
||||
LDFLAGS= @LDFLAGS@
|
||||
LDFLAGS=@LDFLAGS@
|
||||
FRAMEWORKUNIXTOOLSPREFIX=@FRAMEWORKUNIXTOOLSPREFIX@
|
||||
|
||||
# These are normally glimpsed from the previous set
|
||||
bindir=@exec_prefix@/bin
|
||||
bindir=$(prefix)/bin
|
||||
PYTHONAPPSDIR=/Applications/MacPython $(VERSION)
|
||||
APPINSTALLDIR=$(prefix)/Resources/Python.app
|
||||
|
||||
# Variables for installing the "normal" unix binaries
|
||||
INSTALLED_PYDOC=$(prefix)/bin/pydoc
|
||||
INSTALLED_IDLE=$(prefix)/bin/idle
|
||||
INSTALLED_PYTHON=$(prefix)/bin/python
|
||||
INSTALLED_PYTHONW=$(prefix)/bin/pythonw
|
||||
INSTALLED_PYTHONAPP=$(APPINSTALLDIR)/Contents/MacOS/Python
|
||||
|
||||
# Items more-or-less copied from the main Makefile
|
||||
|
@ -36,15 +34,15 @@ LN=@LN@
|
|||
STRIPFLAG=-s
|
||||
CPMAC=/Developer/Tools/CpMac
|
||||
|
||||
APPTEMPLATE=$(srcdir)/../OSXResources/app
|
||||
APPTEMPLATE=$(srcdir)/Resources/app
|
||||
APPSUBDIRS=MacOS Resources Resources/English.lproj \
|
||||
Resources/English.lproj/Documentation \
|
||||
Resources/English.lproj/Documentation/doc \
|
||||
Resources/English.lproj/Documentation/ide
|
||||
DOCDIR=$(srcdir)/../OSXResources/app/Resources/English.lproj/Documentation
|
||||
DOCDIR=$(srcdir)/Resources/app/Resources/English.lproj/Documentation
|
||||
DOCINDEX=$(DOCDIR)/"Documentation idx"
|
||||
CACHERSRC=$(srcdir)/../scripts/cachersrc.py
|
||||
compileall=$(srcdir)/../../Lib/compileall.py
|
||||
CACHERSRC=$(srcdir)/scripts/cachersrc.py
|
||||
compileall=$(srcdir)/../Lib/compileall.py
|
||||
|
||||
installapps: install_Python install_BuildApplet install_PythonLauncher \
|
||||
install_IDLE checkapplepython install_pythonw install_versionedtools
|
||||
|
@ -163,11 +161,11 @@ install_IDLE:
|
|||
cd IDLE && make install
|
||||
|
||||
install_BuildApplet:
|
||||
$(BUILDPYTHON) $(srcdir)/../scripts/BuildApplet.py \
|
||||
$(RUNSHARED) $(BUILDPYTHON) $(srcdir)/scripts/BuildApplet.py \
|
||||
--destroot "$(DESTDIR)" \
|
||||
--python $(INSTALLED_PYTHONAPP) \
|
||||
--output "$(DESTDIR)$(PYTHONAPPSDIR)/Build Applet.app" \
|
||||
$(srcdir)/../scripts/BuildApplet.py
|
||||
$(srcdir)/scripts/BuildApplet.py
|
||||
|
||||
MACLIBDEST=$(LIBDEST)/plat-mac
|
||||
MACTOOLSDEST=$(prefix)/Mac/Tools
|
||||
|
@ -225,29 +223,25 @@ installmacsubtree:
|
|||
done
|
||||
|
||||
|
||||
$(BUILDPYTHON) $(CACHERSRC) -v $(DESTDIR)$(MACLIBDEST) $(DESTDIR)$(MACTOOLSDEST)
|
||||
$(BUILDPYTHON) -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST)
|
||||
$(BUILDPYTHON) -O -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST)
|
||||
$(RUNSHARED) $(BUILDPYTHON) $(CACHERSRC) -v $(DESTDIR)$(MACLIBDEST) $(DESTDIR)$(MACTOOLSDEST)
|
||||
$(RUNSHARED) $(BUILDPYTHON) -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST)
|
||||
$(RUNSHARED) $(BUILDPYTHON) -O -Wi -tt $(compileall) -d $(MACTOOLSDEST) -x badsyntax $(DESTDIR)$(MACTOOLSDEST)
|
||||
|
||||
#
|
||||
# We use the full name here in stead of $(INSTALLED_PYTHONAPP), because
|
||||
# the latter may be overridden by Makefile.jaguar when building for a pre-installed
|
||||
$(APPINSTALLDIR)/Contents/MacOS/Python: install_Python
|
||||
$(INSTALLED_PYTHONAPP): install_Python
|
||||
|
||||
# $(INSTALLED_PYTHON) has to be done by the main Makefile, we cannot do that here.
|
||||
# At least this rule will give an error if it doesn't exist.
|
||||
|
||||
installextras:
|
||||
installextras: $(srcdir)/Extras.ReadMe.txt $(srcdir)/Extras.install.py
|
||||
$(INSTALL) -d "$(DESTDIR)$(PYTHONAPPSDIR)/Extras"
|
||||
$(INSTALL) $(srcdir)/Mac/OSX/Extras.ReadMe.txt "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/ReadMe.txt"
|
||||
$(BUILDPYTHON) $(srcdir)/Mac/OSX/Extras.install.py $(srcdir)/Demo \
|
||||
$(INSTALL) $(srcdir)/Extras.ReadMe.txt "$(DESTDIR)$(PYTHONAPPSDIR)/Extras/ReadMe.txt"
|
||||
$(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/../Demo \
|
||||
"$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo"
|
||||
$(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Extras.install.py $(srcdir)/Demo \
|
||||
"$(DESTDIR)$(PYTHONAPPSDIR)/Extras/Demo.Mac"
|
||||
|
||||
|
||||
checkapplepython:
|
||||
@if ! $(BUILDPYTHON) $(srcdir)/fixapplepython23.py -n; then \
|
||||
checkapplepython: $(srcdir)/Tools/fixapplepython23.py
|
||||
@if ! $(RUNSHARED) $(BUILDPYTHON) $(srcdir)/Tools/fixapplepython23.py -n; then \
|
||||
echo "* WARNING: Apple-installed Python 2.3 will have trouble building extensions from now on."; \
|
||||
echo "* WARNING: Run $(srcdir)/fixapplepython23.py with \"sudo\" to fix this."; \
|
||||
echo "* WARNING: Run $(srcdir)/Tools/fixapplepython23.py with \"sudo\" to fix this."; \
|
||||
fi
|
||||
|
||||
|
||||
|
@ -255,5 +249,3 @@ clean:
|
|||
rm pythonw
|
||||
cd PythonLauncher && make clean
|
||||
cd IDLE && make clean
|
||||
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
Building a MacPython distribution
|
||||
=================================
|
||||
|
||||
The ``build-install.py`` script creates MacPython distributions, including
|
||||
sleepycat db4, sqlite3 and readline support. It builds a complete
|
||||
framework-based Python out-of-tree, installs it in a funny place with
|
||||
$DESTROOT, massages that installation to remove .pyc files and such, creates
|
||||
an Installer package from the installation plus other files in ``resources``
|
||||
and ``scripts`` and placed that on a ``.dmg`` disk image.
|
||||
|
||||
Here are the steps you ned to follow to build a MacPython installer:
|
||||
|
||||
- Run ``./build-installer.py``. Optionally you can pass a number of arguments
|
||||
to specify locations of various files. Please see the top of
|
||||
``build-installer.py`` for its usage.
|
||||
- When done the script will tell you where the DMG image is.
|
||||
|
||||
The script needs to be run on Mac OS X 10.4 with Xcode 2.2 or later and
|
||||
the 10.4u SDK.
|
||||
|
||||
When all is done, announcements can be posted to at least the following
|
||||
places:
|
||||
- pythonmac-sig@python.org
|
||||
- python-dev@python.org
|
||||
- python-announce@python.org
|
||||
- archivist@info-mac.org
|
||||
- adcnews@apple.com
|
||||
- news@macnn.com
|
||||
- http://www.macupdate.com
|
||||
- http://guide.apple.com/usindex.lasso
|
||||
- http://www.apple.com/downloads/macosx/submit
|
||||
- http://www.versiontracker.com/ (userid Jack.Jansen@oratrix.com)
|
||||
- http://www.macshareware.net (userid jackjansen)
|
||||
|
||||
Also, check out Stephan Deibels http://pythonology.org/market contact list
|
|
@ -1,36 +0,0 @@
|
|||
diff -r -u ncurses-5.5-orig/test/Makefile.in ncurses-5.5/test/Makefile.in
|
||||
--- ncurses-5.5-orig/test/Makefile.in 2006-03-24 12:47:40.000000000 +0100
|
||||
+++ ncurses-5.5/test/Makefile.in 2006-03-24 12:47:50.000000000 +0100
|
||||
@@ -75,7 +75,7 @@
|
||||
MATH_LIB = @MATH_LIB@
|
||||
|
||||
LD = @LD@
|
||||
-LINK = @LINK_TESTS@ $(LIBTOOL_LINK) $(CC) $(CFLAGS)
|
||||
+LINK = @LINK_TESTS@ $(LIBTOOL_LINK) $(CC)
|
||||
|
||||
usFLAGS = @LD_MODEL@ @LOCAL_LDFLAGS@ @LDFLAGS@
|
||||
|
||||
diff -ru ncurses-5.5-orig/ncurses/tinfo/read_entry.c ncurses-5.5/ncurses/tinfo/read_entry.c
|
||||
--- ncurses-5.5-orig/ncurses/tinfo/read_entry.c 2004-01-11 02:57:05.000000000 +0100
|
||||
+++ ncurses-5.5/ncurses/tinfo/read_entry.c 2006-03-25 22:49:39.000000000 +0100
|
||||
@@ -474,7 +474,7 @@
|
||||
}
|
||||
|
||||
/* truncate the terminal name to prevent buffer overflow */
|
||||
- (void) sprintf(ttn, "%c/%.*s", *tn, (int) sizeof(ttn) - 3, tn);
|
||||
+ (void) sprintf(ttn, "%x/%.*s", *tn, (int) sizeof(ttn) - 3, tn);
|
||||
|
||||
/* This is System V behavior, in conjunction with our requirements for
|
||||
* writing terminfo entries.
|
||||
diff -ru ncurses-5.5-orig/configure ncurses-5.5/configure
|
||||
--- ncurses-5.5-orig/configure 2005-09-24 23:50:50.000000000 +0200
|
||||
+++ ncurses-5.5/configure 2006-03-26 22:24:59.000000000 +0200
|
||||
@@ -5027,7 +5027,7 @@
|
||||
darwin*)
|
||||
EXTRA_CFLAGS="-no-cpp-precomp"
|
||||
CC_SHARED_OPTS="-dynamic"
|
||||
- MK_SHARED_LIB='$(CC) -dynamiclib -install_name $(DESTDIR)$(libdir)/`basename $@` -compatibility_version $(ABI_VERSION) -current_version $(ABI_VERSION) -o $@'
|
||||
+ MK_SHARED_LIB='$(CC) $(CFLAGS) -dynamiclib -install_name $(DESTDIR)$(libdir)/`basename $@` -compatibility_version $(ABI_VERSION) -current_version $(ABI_VERSION) -o $@'
|
||||
test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi
|
||||
cf_cv_shlib_version_infix=yes
|
||||
;;
|
|
@ -1,31 +0,0 @@
|
|||
This package will install MacPython $FULL_VERSION for Mac OS X
|
||||
$MACOSX_DEPLOYMENT_TARGET for the following
|
||||
architecture(s): $ARCHITECTURES.
|
||||
|
||||
Separate installers are available for older versions
|
||||
of Mac OS X, see the homepage, below.
|
||||
|
||||
Installation requires approximately $INSTALL_SIZE 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.
|
||||
|
||||
MacPython consists of the Python programming language
|
||||
interpreter, plus a set of programs to allow easy
|
||||
access to it for Mac users (an integrated development
|
||||
environment, an applet builder), plus a set of pre-built
|
||||
extension modules that open up specific Macintosh technologies
|
||||
to Python programs (Carbon, AppleScript, Quicktime, more).
|
||||
|
||||
The installer puts the applications in "MacPython $VERSION"
|
||||
in your Applications folder, command-line tools in
|
||||
/usr/local/bin and the underlying machinery in
|
||||
$PYTHONFRAMEWORKINSTALLDIR.
|
||||
|
||||
More information on MacPython can be found at
|
||||
http://www.cwi.nl/~jack/macpython and
|
||||
http://pythonmac.org/. More information on
|
||||
Python in general can be found at
|
||||
http://www.python.org.
|
|
@ -1,15 +0,0 @@
|
|||
{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf330
|
||||
{\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
|
||||
\f1\b MacPython $FULL_VERSION
|
||||
\f0\b0 for
|
||||
\f1\b Mac OS X $MACOSX_DEPLOYMENT_TARGET
|
||||
\f0\b0 .\
|
||||
\
|
||||
MacPython consists of the Python programming language interpreter, plus a set of programs to allow easy access to it for Mac users (an integrated development environment, an applet builder), plus a set of pre-built extension modules that open up specific Macintosh technologies to Python programs (Carbon, AppleScript, Quicktime, more).\
|
||||
\
|
||||
See the ReadMe file for more information.}
|
Before Width: | Height: | Size: 44 KiB |
|
@ -1,12 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# FIXME
|
||||
PYVER="@PYVER@"
|
||||
|
||||
if [ -d /Developer/Documentation ]; then
|
||||
if [ ! -d /Developer/Documentation/Python ]; then
|
||||
mkdir -p /Developer/Documentation/Python
|
||||
fi
|
||||
|
||||
ln -fhs /Library/Frameworks/Python.framework/Versions/${PYVER}/Resources/English.lproj/Documentation "/Developer/Documentation/Python/Reference Documentation"
|
||||
fi
|
|
@ -1,33 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Recompile the .py files.
|
||||
#
|
||||
|
||||
PYVER="@PYVER@"
|
||||
FWK="/Library/Frameworks/Python.framework/Versions/@PYVER@/"
|
||||
|
||||
"${FWK}/bin/python" -Wi -tt \
|
||||
"${FWK}/lib/python${PYVER}/compileall.py" \
|
||||
-x badsyntax -x site-packages \
|
||||
"${FWK}/lib/python${PYVER}"
|
||||
|
||||
"${FWK}/bin/python" -Wi -tt -O \
|
||||
"${FWK}/lib/python${PYVER}/compileall.py" \
|
||||
-x badsyntax -x site-packages \
|
||||
"${FWK}/lib/python${PYVER}"
|
||||
|
||||
"${FWK}/bin/python" -Wi -tt \
|
||||
"${FWK}/lib/python${PYVER}/compileall.py" \
|
||||
-x badsyntax -x site-packages \
|
||||
"${FWK}/Mac/Tools"
|
||||
|
||||
"${FWK}/bin/python" -Wi -tt -O \
|
||||
"${FWK}/lib/python${PYVER}/compileall.py" \
|
||||
-x badsyntax -x site-packages \
|
||||
"${FWK}/Mac/Tools"
|
||||
|
||||
|
||||
chown -R admin "${FWK}"
|
||||
chmod -R g+w "${FWK}"
|
||||
|
||||
exit 0
|
|
@ -1,71 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
echo "This script will update your shell profile when the 'bin' directory"
|
||||
echo "of python is not early enough of the PATH of your shell."
|
||||
echo "These changes will be effective only in shell windows that you open"
|
||||
echo "after running this script."
|
||||
|
||||
PYVER=@PYVER@
|
||||
PYTHON_ROOT="/Library/Frameworks/Python.framework/Versions/Current"
|
||||
|
||||
# Make sure the directory ${PYTHON_ROOT}/bin is on the users PATH.
|
||||
BSH="`basename "${SHELL}"`"
|
||||
case "${BSH}" in
|
||||
bash|ksh|sh|*csh)
|
||||
P="`${SHELL} -c 'echo $PATH'`"
|
||||
;;
|
||||
*)
|
||||
echo "Sorry, I don't know how to patch $BSH shells"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
# Now ensure that our bin directory is on $P and before /usr/bin at that
|
||||
for elem in `echo $P | tr ':' ' '`
|
||||
do
|
||||
if [ "${elem}" == "${PYTHON_ROOT}/bin" ]; then
|
||||
echo "All right, you're a python lover already"
|
||||
exit 0
|
||||
elif [ "${elem}" == "/usr/bin" ]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
echo "${PYTHON_ROOT}/bin is not on your PATH or at least not early enough"
|
||||
case "${BSH}" in
|
||||
*csh)
|
||||
# Create backup copy before patching
|
||||
if [ -f "${HOME}/.cshrc" ]; then
|
||||
cp -fp "${HOME}/.cshrc" "${HOME}/.cshrc.pysave"
|
||||
fi
|
||||
echo "" >> "${HOME}/.cshrc"
|
||||
echo "# Setting PATH for MacPython ${PYVER}" >> "${HOME}/.cshrc"
|
||||
echo "# The orginal version is saved in .cshrc.pysave" >> "${HOME}/.cshrc"
|
||||
echo "set path=(${PYTHON_ROOT}/bin "'$path'")" >> "${HOME}/.cshrc"
|
||||
exit 0
|
||||
;;
|
||||
bash)
|
||||
if [ -e "${HOME}/.profile" ]; then
|
||||
PR="${HOME}/.profile"
|
||||
else
|
||||
PR="${HOME}/.bash_profile"
|
||||
fi
|
||||
;;
|
||||
*sh)
|
||||
PR="${HOME}/.profile"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Create backup copy before patching
|
||||
if [ -f "${PR}" ]; then
|
||||
cp -fp "${PR}" "${PR}.pysave"
|
||||
fi
|
||||
echo "" >> "${PR}"
|
||||
echo "# Setting PATH for MacPython ${PYVER}" >> "${PR}"
|
||||
echo "# The orginal version is saved in `basename ${PR}`.pysave" >> "${PR}"
|
||||
echo 'PATH="'"${PYTHON_ROOT}/bin"':${PATH}"' >> "${PR}"
|
||||
echo 'export PATH' >> "${PR}"
|
||||
if [ `id -ur` = 0 ]; then
|
||||
chown "${LOGNAME}" "${PR}"
|
||||
fi
|
||||
exit 0
|
|
@ -1,110 +0,0 @@
|
|||
"""Suite Help Indexing Tool Suite: Special events that just the Help Indexing Tool supports.
|
||||
Level 0, version 0
|
||||
|
||||
Generated from /Developer/Applications/Apple Help Indexing Tool.app
|
||||
AETE/AEUT resource version 1/1, language 0, script 0
|
||||
"""
|
||||
|
||||
import aetools
|
||||
import MacOS
|
||||
|
||||
_code = 'HIT '
|
||||
|
||||
class Help_Indexing_Tool_Suite_Events:
|
||||
|
||||
def turn_anchor_indexing(self, _object, _attributes={}, **_arguments):
|
||||
"""turn anchor indexing: Turns anchor indexing on or off.
|
||||
Required argument: \xd2on\xd3 or \xd2off\xd3, to turn anchor indexing on or off
|
||||
Keyword argument _attributes: AppleEvent attribute dictionary
|
||||
"""
|
||||
_code = 'HIT '
|
||||
_subcode = 'tAnc'
|
||||
|
||||
if _arguments: raise TypeError, 'No optional args expected'
|
||||
_arguments['----'] = _object
|
||||
|
||||
|
||||
_reply, _arguments, _attributes = self.send(_code, _subcode,
|
||||
_arguments, _attributes)
|
||||
if _arguments.get('errn', 0):
|
||||
raise aetools.Error, aetools.decodeerror(_arguments)
|
||||
# XXXX Optionally decode result
|
||||
if _arguments.has_key('----'):
|
||||
return _arguments['----']
|
||||
|
||||
_argmap_turn_remote_root = {
|
||||
'with_root_url' : 'rURL',
|
||||
}
|
||||
|
||||
def turn_remote_root(self, _object, _attributes={}, **_arguments):
|
||||
"""turn remote root: Turn usage of remote root for content on the web on or off. If turning \xd2on\xd3, supply a string as second parameter.
|
||||
Required argument: \xd2on\xd3 or \xd2off\xd3, to turn remote root on or off
|
||||
Keyword argument with_root_url: The remote root to use, in the form of \xd2http://www.apple.com/help/\xd3.
|
||||
Keyword argument _attributes: AppleEvent attribute dictionary
|
||||
"""
|
||||
_code = 'HIT '
|
||||
_subcode = 'tRem'
|
||||
|
||||
aetools.keysubst(_arguments, self._argmap_turn_remote_root)
|
||||
_arguments['----'] = _object
|
||||
|
||||
|
||||
_reply, _arguments, _attributes = self.send(_code, _subcode,
|
||||
_arguments, _attributes)
|
||||
if _arguments.get('errn', 0):
|
||||
raise aetools.Error, aetools.decodeerror(_arguments)
|
||||
# XXXX Optionally decode result
|
||||
if _arguments.has_key('----'):
|
||||
return _arguments['----']
|
||||
|
||||
def use_tokenizer(self, _object, _attributes={}, **_arguments):
|
||||
"""use tokenizer: Tells the indexing tool which tokenizer to use.
|
||||
Required argument: Specify \xd2English\xd3, \xd2European\xd3, \xd2Japanese\xd3, \xd2Korean\xd3, or \xd2Simple\xd3.
|
||||
Keyword argument _attributes: AppleEvent attribute dictionary
|
||||
"""
|
||||
_code = 'HIT '
|
||||
_subcode = 'uTok'
|
||||
|
||||
if _arguments: raise TypeError, 'No optional args expected'
|
||||
_arguments['----'] = _object
|
||||
|
||||
|
||||
_reply, _arguments, _attributes = self.send(_code, _subcode,
|
||||
_arguments, _attributes)
|
||||
if _arguments.get('errn', 0):
|
||||
raise aetools.Error, aetools.decodeerror(_arguments)
|
||||
# XXXX Optionally decode result
|
||||
if _arguments.has_key('----'):
|
||||
return _arguments['----']
|
||||
|
||||
|
||||
class application(aetools.ComponentItem):
|
||||
"""application - Application class """
|
||||
want = 'capp'
|
||||
class _Prop_idleStatus(aetools.NProperty):
|
||||
"""idleStatus - """
|
||||
which = 'sIdl'
|
||||
want = 'bool'
|
||||
application._superclassnames = []
|
||||
application._privpropdict = {
|
||||
'idleStatus' : _Prop_idleStatus,
|
||||
}
|
||||
application._privelemdict = {
|
||||
}
|
||||
|
||||
#
|
||||
# Indices of types declared in this module
|
||||
#
|
||||
_classdeclarations = {
|
||||
'capp' : application,
|
||||
}
|
||||
|
||||
_propdeclarations = {
|
||||
'sIdl' : _Prop_idleStatus,
|
||||
}
|
||||
|
||||
_compdeclarations = {
|
||||
}
|
||||
|
||||
_enumdeclarations = {
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
"""Suite Miscellaneous Standards: Useful events that aren\xd5t in any other suite
|
||||
Level 0, version 0
|
||||
|
||||
Generated from /Developer/Applications/Apple Help Indexing Tool.app
|
||||
AETE/AEUT resource version 1/1, language 0, script 0
|
||||
"""
|
||||
|
||||
import aetools
|
||||
import MacOS
|
||||
|
||||
_code = 'misc'
|
||||
|
||||
class Miscellaneous_Standards_Events:
|
||||
|
||||
def revert(self, _object, _attributes={}, **_arguments):
|
||||
"""revert: Revert an object to the most recently saved version
|
||||
Required argument: object to revert
|
||||
Keyword argument _attributes: AppleEvent attribute dictionary
|
||||
"""
|
||||
_code = 'misc'
|
||||
_subcode = 'rvrt'
|
||||
|
||||
if _arguments: raise TypeError, 'No optional args expected'
|
||||
_arguments['----'] = _object
|
||||
|
||||
|
||||
_reply, _arguments, _attributes = self.send(_code, _subcode,
|
||||
_arguments, _attributes)
|
||||
if _arguments.get('errn', 0):
|
||||
raise aetools.Error, aetools.decodeerror(_arguments)
|
||||
# XXXX Optionally decode result
|
||||
if _arguments.has_key('----'):
|
||||
return _arguments['----']
|
||||
|
||||
|
||||
#
|
||||
# Indices of types declared in this module
|
||||
#
|
||||
_classdeclarations = {
|
||||
}
|
||||
|
||||
_propdeclarations = {
|
||||
}
|
||||
|
||||
_compdeclarations = {
|
||||
}
|
||||
|
||||
_enumdeclarations = {
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
"""Suite Required Suite: Terms that every application should support
|
||||
Level 1, version 1
|
||||
|
||||
Generated from /Developer/Applications/Apple Help Indexing Tool.app
|
||||
AETE/AEUT resource version 1/1, language 0, script 0
|
||||
"""
|
||||
|
||||
import aetools
|
||||
import MacOS
|
||||
|
||||
_code = 'reqd'
|
||||
|
||||
from StdSuites.Required_Suite import *
|
||||
class Required_Suite_Events(Required_Suite_Events):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
#
|
||||
# Indices of types declared in this module
|
||||
#
|
||||
_classdeclarations = {
|
||||
}
|
||||
|
||||
_propdeclarations = {
|
||||
}
|
||||
|
||||
_compdeclarations = {
|
||||
}
|
||||
|
||||
_enumdeclarations = {
|
||||
}
|
|
@ -1,343 +0,0 @@
|
|||
"""Suite Standard Suite: Common terms for most applications
|
||||
Level 1, version 1
|
||||
|
||||
Generated from /Developer/Applications/Apple Help Indexing Tool.app
|
||||
AETE/AEUT resource version 1/1, language 0, script 0
|
||||
"""
|
||||
|
||||
import aetools
|
||||
import MacOS
|
||||
|
||||
_code = 'CoRe'
|
||||
|
||||
from StdSuites.Standard_Suite import *
|
||||
class Standard_Suite_Events(Standard_Suite_Events):
|
||||
|
||||
_argmap_close = {
|
||||
'saving' : 'savo',
|
||||
'in_' : 'kfil',
|
||||
}
|
||||
|
||||
def close(self, _object, _attributes={}, **_arguments):
|
||||
"""close: Close an object
|
||||
Required argument: the objects to close
|
||||
Keyword argument saving: specifies whether or not changes should be saved before closing
|
||||
Keyword argument in_: the file in which to save the object
|
||||
Keyword argument _attributes: AppleEvent attribute dictionary
|
||||
"""
|
||||
_code = 'core'
|
||||
_subcode = 'clos'
|
||||
|
||||
aetools.keysubst(_arguments, self._argmap_close)
|
||||
_arguments['----'] = _object
|
||||
|
||||
aetools.enumsubst(_arguments, 'savo', _Enum_savo)
|
||||
|
||||
_reply, _arguments, _attributes = self.send(_code, _subcode,
|
||||
_arguments, _attributes)
|
||||
if _arguments.get('errn', 0):
|
||||
raise aetools.Error, aetools.decodeerror(_arguments)
|
||||
# XXXX Optionally decode result
|
||||
if _arguments.has_key('----'):
|
||||
return _arguments['----']
|
||||
|
||||
def data_size(self, _object, _attributes={}, **_arguments):
|
||||
"""data size: Return the size in bytes of an object
|
||||
Required argument: the object whose data size is to be returned
|
||||
Keyword argument _attributes: AppleEvent attribute dictionary
|
||||
Returns: the size of the object in bytes
|
||||
"""
|
||||
_code = 'core'
|
||||
_subcode = 'dsiz'
|
||||
|
||||
if _arguments: raise TypeError, 'No optional args expected'
|
||||
_arguments['----'] = _object
|
||||
|
||||
|
||||
_reply, _arguments, _attributes = self.send(_code, _subcode,
|
||||
_arguments, _attributes)
|
||||
if _arguments.get('errn', 0):
|
||||
raise aetools.Error, aetools.decodeerror(_arguments)
|
||||
# XXXX Optionally decode result
|
||||
if _arguments.has_key('----'):
|
||||
return _arguments['----']
|
||||
|
||||
def get(self, _object, _attributes={}, **_arguments):
|
||||
"""get: Get the data for an object
|
||||
Required argument: the object whose data is to be returned
|
||||
Keyword argument _attributes: AppleEvent attribute dictionary
|
||||
Returns: The data from the object
|
||||
"""
|
||||
_code = 'core'
|
||||
_subcode = 'getd'
|
||||
|
||||
if _arguments: raise TypeError, 'No optional args expected'
|
||||
_arguments['----'] = _object
|
||||
|
||||
|
||||
_reply, _arguments, _attributes = self.send(_code, _subcode,
|
||||
_arguments, _attributes)
|
||||
if _arguments.get('errn', 0):
|
||||
raise aetools.Error, aetools.decodeerror(_arguments)
|
||||
# XXXX Optionally decode result
|
||||
if _arguments.has_key('----'):
|
||||
return _arguments['----']
|
||||
|
||||
_argmap_make = {
|
||||
'new' : 'kocl',
|
||||
'at' : 'insh',
|
||||
'with_data' : 'data',
|
||||
'with_properties' : 'prdt',
|
||||
}
|
||||
|
||||
def make(self, _no_object=None, _attributes={}, **_arguments):
|
||||
"""make: Make a new element
|
||||
Keyword argument new: the class of the new element
|
||||
Keyword argument at: the location at which to insert the element
|
||||
Keyword argument with_data: the initial data for the element
|
||||
Keyword argument with_properties: the initial values for the properties of the element
|
||||
Keyword argument _attributes: AppleEvent attribute dictionary
|
||||
Returns: Object specifier for the new element
|
||||
"""
|
||||
_code = 'core'
|
||||
_subcode = 'crel'
|
||||
|
||||
aetools.keysubst(_arguments, self._argmap_make)
|
||||
if _no_object != None: raise TypeError, 'No direct arg expected'
|
||||
|
||||
|
||||
_reply, _arguments, _attributes = self.send(_code, _subcode,
|
||||
_arguments, _attributes)
|
||||
if _arguments.get('errn', 0):
|
||||
raise aetools.Error, aetools.decodeerror(_arguments)
|
||||
# XXXX Optionally decode result
|
||||
if _arguments.has_key('----'):
|
||||
return _arguments['----']
|
||||
|
||||
def open(self, _object, _attributes={}, **_arguments):
|
||||
"""open: Open the specified object(s)
|
||||
Required argument: Objects to open. Can be a list of files or an object specifier.
|
||||
Keyword argument _attributes: AppleEvent attribute dictionary
|
||||
"""
|
||||
_code = 'aevt'
|
||||
_subcode = 'odoc'
|
||||
|
||||
if _arguments: raise TypeError, 'No optional args expected'
|
||||
_arguments['----'] = _object
|
||||
|
||||
|
||||
_reply, _arguments, _attributes = self.send(_code, _subcode,
|
||||
_arguments, _attributes)
|
||||
if _arguments.get('errn', 0):
|
||||
raise aetools.Error, aetools.decodeerror(_arguments)
|
||||
# XXXX Optionally decode result
|
||||
if _arguments.has_key('----'):
|
||||
return _arguments['----']
|
||||
|
||||
def print_(self, _object, _attributes={}, **_arguments):
|
||||
"""print: Print the specified object(s)
|
||||
Required argument: Objects to print. Can be a list of files or an object specifier.
|
||||
Keyword argument _attributes: AppleEvent attribute dictionary
|
||||
"""
|
||||
_code = 'aevt'
|
||||
_subcode = 'pdoc'
|
||||
|
||||
if _arguments: raise TypeError, 'No optional args expected'
|
||||
_arguments['----'] = _object
|
||||
|
||||
|
||||
_reply, _arguments, _attributes = self.send(_code, _subcode,
|
||||
_arguments, _attributes)
|
||||
if _arguments.get('errn', 0):
|
||||
raise aetools.Error, aetools.decodeerror(_arguments)
|
||||
# XXXX Optionally decode result
|
||||
if _arguments.has_key('----'):
|
||||
return _arguments['----']
|
||||
|
||||
_argmap_save = {
|
||||
'in_' : 'kfil',
|
||||
'as' : 'fltp',
|
||||
}
|
||||
|
||||
def save(self, _object, _attributes={}, **_arguments):
|
||||
"""save: save a set of objects
|
||||
Required argument: Objects to save.
|
||||
Keyword argument in_: the file in which to save the object(s)
|
||||
Keyword argument as: the file type of the document in which to save the data
|
||||
Keyword argument _attributes: AppleEvent attribute dictionary
|
||||
"""
|
||||
_code = 'core'
|
||||
_subcode = 'save'
|
||||
|
||||
aetools.keysubst(_arguments, self._argmap_save)
|
||||
_arguments['----'] = _object
|
||||
|
||||
|
||||
_reply, _arguments, _attributes = self.send(_code, _subcode,
|
||||
_arguments, _attributes)
|
||||
if _arguments.get('errn', 0):
|
||||
raise aetools.Error, aetools.decodeerror(_arguments)
|
||||
# XXXX Optionally decode result
|
||||
if _arguments.has_key('----'):
|
||||
return _arguments['----']
|
||||
|
||||
_argmap_set = {
|
||||
'to' : 'data',
|
||||
}
|
||||
|
||||
def set(self, _object, _attributes={}, **_arguments):
|
||||
"""set: Set an object\xd5s data
|
||||
Required argument: the object to change
|
||||
Keyword argument to: the new value
|
||||
Keyword argument _attributes: AppleEvent attribute dictionary
|
||||
"""
|
||||
_code = 'core'
|
||||
_subcode = 'setd'
|
||||
|
||||
aetools.keysubst(_arguments, self._argmap_set)
|
||||
_arguments['----'] = _object
|
||||
|
||||
|
||||
_reply, _arguments, _attributes = self.send(_code, _subcode,
|
||||
_arguments, _attributes)
|
||||
if _arguments.get('errn', 0):
|
||||
raise aetools.Error, aetools.decodeerror(_arguments)
|
||||
# XXXX Optionally decode result
|
||||
if _arguments.has_key('----'):
|
||||
return _arguments['----']
|
||||
|
||||
|
||||
class application(aetools.ComponentItem):
|
||||
"""application - An application program """
|
||||
want = 'capp'
|
||||
# element 'cwin' as ['indx', 'name', 'rele']
|
||||
# element 'docu' as ['name']
|
||||
|
||||
class window(aetools.ComponentItem):
|
||||
"""window - A Window """
|
||||
want = 'cwin'
|
||||
class _Prop_bounds(aetools.NProperty):
|
||||
"""bounds - the boundary rectangle for the window """
|
||||
which = 'pbnd'
|
||||
want = 'qdrt'
|
||||
class _Prop_closeable(aetools.NProperty):
|
||||
"""closeable - Does the window have a close box? """
|
||||
which = 'hclb'
|
||||
want = 'bool'
|
||||
class _Prop_floating(aetools.NProperty):
|
||||
"""floating - Does the window float? """
|
||||
which = 'isfl'
|
||||
want = 'bool'
|
||||
class _Prop_index(aetools.NProperty):
|
||||
"""index - the number of the window """
|
||||
which = 'pidx'
|
||||
want = 'long'
|
||||
class _Prop_modal(aetools.NProperty):
|
||||
"""modal - Is the window modal? """
|
||||
which = 'pmod'
|
||||
want = 'bool'
|
||||
class _Prop_name(aetools.NProperty):
|
||||
"""name - the title of the window """
|
||||
which = 'pnam'
|
||||
want = 'itxt'
|
||||
class _Prop_position(aetools.NProperty):
|
||||
"""position - upper left coordinates of window """
|
||||
which = 'ppos'
|
||||
want = 'QDpt'
|
||||
class _Prop_resizable(aetools.NProperty):
|
||||
"""resizable - Is the window resizable? """
|
||||
which = 'prsz'
|
||||
want = 'bool'
|
||||
class _Prop_titled(aetools.NProperty):
|
||||
"""titled - Does the window have a title bar? """
|
||||
which = 'ptit'
|
||||
want = 'bool'
|
||||
class _Prop_visible(aetools.NProperty):
|
||||
"""visible - is the window visible? """
|
||||
which = 'pvis'
|
||||
want = 'bool'
|
||||
class _Prop_zoomable(aetools.NProperty):
|
||||
"""zoomable - Is the window zoomable? """
|
||||
which = 'iszm'
|
||||
want = 'bool'
|
||||
class _Prop_zoomed(aetools.NProperty):
|
||||
"""zoomed - Is the window zoomed? """
|
||||
which = 'pzum'
|
||||
want = 'bool'
|
||||
|
||||
class document(aetools.ComponentItem):
|
||||
"""document - A Document """
|
||||
want = 'docu'
|
||||
class _Prop_modified(aetools.NProperty):
|
||||
"""modified - Has the document been modified since the last save? """
|
||||
which = 'imod'
|
||||
want = 'bool'
|
||||
application._superclassnames = []
|
||||
application._privpropdict = {
|
||||
}
|
||||
application._privelemdict = {
|
||||
'document' : document,
|
||||
'window' : window,
|
||||
}
|
||||
window._superclassnames = []
|
||||
window._privpropdict = {
|
||||
'bounds' : _Prop_bounds,
|
||||
'closeable' : _Prop_closeable,
|
||||
'floating' : _Prop_floating,
|
||||
'index' : _Prop_index,
|
||||
'modal' : _Prop_modal,
|
||||
'name' : _Prop_name,
|
||||
'position' : _Prop_position,
|
||||
'resizable' : _Prop_resizable,
|
||||
'titled' : _Prop_titled,
|
||||
'visible' : _Prop_visible,
|
||||
'zoomable' : _Prop_zoomable,
|
||||
'zoomed' : _Prop_zoomed,
|
||||
}
|
||||
window._privelemdict = {
|
||||
}
|
||||
document._superclassnames = []
|
||||
document._privpropdict = {
|
||||
'modified' : _Prop_modified,
|
||||
'name' : _Prop_name,
|
||||
}
|
||||
document._privelemdict = {
|
||||
}
|
||||
_Enum_savo = {
|
||||
'yes' : 'yes ', # Save objects now
|
||||
'no' : 'no ', # Do not save objects
|
||||
'ask' : 'ask ', # Ask the user whether to save
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Indices of types declared in this module
|
||||
#
|
||||
_classdeclarations = {
|
||||
'capp' : application,
|
||||
'cwin' : window,
|
||||
'docu' : document,
|
||||
}
|
||||
|
||||
_propdeclarations = {
|
||||
'hclb' : _Prop_closeable,
|
||||
'imod' : _Prop_modified,
|
||||
'isfl' : _Prop_floating,
|
||||
'iszm' : _Prop_zoomable,
|
||||
'pbnd' : _Prop_bounds,
|
||||
'pidx' : _Prop_index,
|
||||
'pmod' : _Prop_modal,
|
||||
'pnam' : _Prop_name,
|
||||
'ppos' : _Prop_position,
|
||||
'prsz' : _Prop_resizable,
|
||||
'ptit' : _Prop_titled,
|
||||
'pvis' : _Prop_visible,
|
||||
'pzum' : _Prop_zoomed,
|
||||
}
|
||||
|
||||
_compdeclarations = {
|
||||
}
|
||||
|
||||
_enumdeclarations = {
|
||||
'savo' : _Enum_savo,
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
"""
|
||||
Package generated from /Developer/Applications/Apple Help Indexing Tool.app
|
||||
"""
|
||||
import aetools
|
||||
Error = aetools.Error
|
||||
import Standard_Suite
|
||||
import Help_Indexing_Tool_Suite
|
||||
import odds_and_ends
|
||||
import Miscellaneous_Standards
|
||||
import Required_Suite
|
||||
|
||||
|
||||
_code_to_module = {
|
||||
'CoRe' : Standard_Suite,
|
||||
'HIT ' : Help_Indexing_Tool_Suite,
|
||||
'Odds' : odds_and_ends,
|
||||
'misc' : Miscellaneous_Standards,
|
||||
'reqd' : Required_Suite,
|
||||
}
|
||||
|
||||
|
||||
|
||||
_code_to_fullname = {
|
||||
'CoRe' : ('HelpIndexingTool.Standard_Suite', 'Standard_Suite'),
|
||||
'HIT ' : ('HelpIndexingTool.Help_Indexing_Tool_Suite', 'Help_Indexing_Tool_Suite'),
|
||||
'Odds' : ('HelpIndexingTool.odds_and_ends', 'odds_and_ends'),
|
||||
'misc' : ('HelpIndexingTool.Miscellaneous_Standards', 'Miscellaneous_Standards'),
|
||||
'reqd' : ('HelpIndexingTool.Required_Suite', 'Required_Suite'),
|
||||
}
|
||||
|
||||
from Standard_Suite import *
|
||||
from Help_Indexing_Tool_Suite import *
|
||||
from odds_and_ends import *
|
||||
from Miscellaneous_Standards import *
|
||||
from Required_Suite import *
|
||||
|
||||
def getbaseclasses(v):
|
||||
if not getattr(v, '_propdict', None):
|
||||
v._propdict = {}
|
||||
v._elemdict = {}
|
||||
for superclassname in getattr(v, '_superclassnames', []):
|
||||
superclass = eval(superclassname)
|
||||
getbaseclasses(superclass)
|
||||
v._propdict.update(getattr(superclass, '_propdict', {}))
|
||||
v._elemdict.update(getattr(superclass, '_elemdict', {}))
|
||||
v._propdict.update(getattr(v, '_privpropdict', {}))
|
||||
v._elemdict.update(getattr(v, '_privelemdict', {}))
|
||||
|
||||
import StdSuites
|
||||
|
||||
#
|
||||
# Set property and element dictionaries now that all classes have been defined
|
||||
#
|
||||
getbaseclasses(window)
|
||||
getbaseclasses(application)
|
||||
getbaseclasses(document)
|
||||
getbaseclasses(application)
|
||||
|
||||
#
|
||||
# Indices of types declared in this module
|
||||
#
|
||||
_classdeclarations = {
|
||||
'cwin' : window,
|
||||
'capp' : application,
|
||||
'docu' : document,
|
||||
'capp' : application,
|
||||
}
|
||||
|
||||
|
||||
class HelpIndexingTool(Standard_Suite_Events,
|
||||
Help_Indexing_Tool_Suite_Events,
|
||||
odds_and_ends_Events,
|
||||
Miscellaneous_Standards_Events,
|
||||
Required_Suite_Events,
|
||||
aetools.TalkTo):
|
||||
_signature = 'hiti'
|
||||
|
||||
_moduleName = 'HelpIndexingTool'
|
|
@ -1,49 +0,0 @@
|
|||
"""Suite odds and ends: Things that should be in some standard suite, but aren\xd5t
|
||||
Level 1, version 1
|
||||
|
||||
Generated from /Developer/Applications/Apple Help Indexing Tool.app
|
||||
AETE/AEUT resource version 1/1, language 0, script 0
|
||||
"""
|
||||
|
||||
import aetools
|
||||
import MacOS
|
||||
|
||||
_code = 'Odds'
|
||||
|
||||
class odds_and_ends_Events:
|
||||
|
||||
def select(self, _object=None, _attributes={}, **_arguments):
|
||||
"""select: Select the specified object
|
||||
Required argument: the object to select
|
||||
Keyword argument _attributes: AppleEvent attribute dictionary
|
||||
"""
|
||||
_code = 'misc'
|
||||
_subcode = 'slct'
|
||||
|
||||
if _arguments: raise TypeError, 'No optional args expected'
|
||||
_arguments['----'] = _object
|
||||
|
||||
|
||||
_reply, _arguments, _attributes = self.send(_code, _subcode,
|
||||
_arguments, _attributes)
|
||||
if _arguments.get('errn', 0):
|
||||
raise aetools.Error, aetools.decodeerror(_arguments)
|
||||
# XXXX Optionally decode result
|
||||
if _arguments.has_key('----'):
|
||||
return _arguments['----']
|
||||
|
||||
|
||||
#
|
||||
# Indices of types declared in this module
|
||||
#
|
||||
_classdeclarations = {
|
||||
}
|
||||
|
||||
_propdeclarations = {
|
||||
}
|
||||
|
||||
_compdeclarations = {
|
||||
}
|
||||
|
||||
_enumdeclarations = {
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
In this directory you can build the Python documentation in a form that
|
||||
is suitable for access with Apple Help Viewer. This will enable the
|
||||
"Python Documentation" menu entries in the MacPython IDE Help menu.
|
||||
|
||||
Unfortunately the procedure to build the docs is not very streamlined.
|
||||
|
||||
First, edit setup.py. At the top, edit MAJOR_VERSION and MINOR_VERSION,
|
||||
and check that DESTDIR makes sense. The documentation will be installed
|
||||
inside PythonIDE.app.
|
||||
|
||||
In DocBuild.initialize_options, set self.download to True if you want to
|
||||
download the docs. Set it to False if you want to build the docs from
|
||||
the source tree, but this requires LaTex and lots of other stuff.
|
||||
Doable, but not easy.
|
||||
|
||||
Second, if you want to download the docs you may need to do a couple
|
||||
more edits. The way the docs are packaged will often change between
|
||||
major releases. Fiddle DocBuild.downloadDocs to make it do the right
|
||||
thing (download the docs from python.org, unpack them, rename the
|
||||
directory to "build/html").
|
||||
|
||||
After these edits you should be ready to roll. "pythonw setup.py build"
|
||||
should download and unpack (or build) the docs. Next, it will do some
|
||||
magic to make the docs indexable. Finally, it will run the Apple Help
|
||||
Indexing Tool. (This last step is the reason you must use "pythonw" as
|
||||
opposed to "python"). Usually it will time out while waiting for AHIT to
|
||||
do its work. Wait until AHIT is done.
|
||||
|
||||
Now you're ready to install with "python setup.py install".
|
||||
|
||||
After this is done test your work. Fire up PythonIDE, and check that
|
||||
Help->Python Documentation brings up the documentation in the Help Viewer.
|
||||
Also open an IDE edit window, type something like "import sys", select
|
||||
"import", and use Help->Lookup in Python Documentation to check that the
|
||||
index has been generated correctly.
|
|
@ -1,214 +0,0 @@
|
|||
# Build and install an Apple Help Viewer compatible version of the Python
|
||||
# documentation into the framework.
|
||||
# Code by Bill Fancher, with some modifications by Jack Jansen.
|
||||
#
|
||||
# You must run this as a two-step process
|
||||
# 1. python setupDocs.py build
|
||||
# 2. Wait for Apple Help Indexing Tool to finish
|
||||
# 3. python setupDocs.py install
|
||||
#
|
||||
# To do:
|
||||
# - test whether the docs are available locally before downloading
|
||||
# - fix buildDocsFromSource
|
||||
# - Get documentation version from sys.version, fallback to 2.2.1
|
||||
# - See if we can somehow detect that Apple Help Indexing Tool is finished
|
||||
# - data_files to setup() doesn't seem the right way to pass the arguments
|
||||
#
|
||||
import sys, os, re
|
||||
from distutils.cmd import Command
|
||||
from distutils.command.build import build
|
||||
from distutils.core import setup
|
||||
from distutils.file_util import copy_file
|
||||
from distutils.dir_util import copy_tree
|
||||
from distutils.log import log
|
||||
from distutils.spawn import spawn
|
||||
from distutils import sysconfig, dep_util
|
||||
from distutils.util import change_root
|
||||
import HelpIndexingTool
|
||||
import Carbon.File
|
||||
import time
|
||||
|
||||
MAJOR_VERSION='2.4'
|
||||
MINOR_VERSION='2.4.1'
|
||||
DESTDIR='/Applications/MacPython-%s/PythonIDE.app/Contents/Resources/English.lproj/PythonDocumentation' % MAJOR_VERSION
|
||||
|
||||
class DocBuild(build):
|
||||
def initialize_options(self):
|
||||
build.initialize_options(self)
|
||||
self.build_html = None
|
||||
self.build_dest = None
|
||||
self.download = 1
|
||||
self.doc_version = MINOR_VERSION # Only needed if download is true
|
||||
|
||||
def finalize_options(self):
|
||||
build.finalize_options(self)
|
||||
if self.build_html is None:
|
||||
self.build_html = os.path.join(self.build_base, 'html')
|
||||
if self.build_dest is None:
|
||||
self.build_dest = os.path.join(self.build_base, 'PythonDocumentation')
|
||||
|
||||
def spawn(self, *args):
|
||||
spawn(args, 1, self.verbose, self.dry_run)
|
||||
|
||||
def downloadDocs(self):
|
||||
workdir = os.getcwd()
|
||||
# XXX Note: the next strings may change from version to version
|
||||
url = 'http://www.python.org/ftp/python/doc/%s/html-%s.tar.bz2' % \
|
||||
(self.doc_version,self.doc_version)
|
||||
tarfile = 'html-%s.tar.bz2' % self.doc_version
|
||||
dirname = 'Python-Docs-%s' % self.doc_version
|
||||
|
||||
if os.path.exists(self.build_html):
|
||||
raise RuntimeError, '%s: already exists, please remove and try again' % self.build_html
|
||||
os.chdir(self.build_base)
|
||||
self.spawn('curl','-O', url)
|
||||
self.spawn('tar', '-xjf', tarfile)
|
||||
os.rename(dirname, 'html')
|
||||
os.chdir(workdir)
|
||||
## print "** Please unpack %s" % os.path.join(self.build_base, tarfile)
|
||||
## print "** Unpack the files into %s" % self.build_html
|
||||
## raise RuntimeError, "You need to unpack the docs manually"
|
||||
|
||||
def buildDocsFromSource(self):
|
||||
srcdir = '../../..'
|
||||
docdir = os.path.join(srcdir, 'Doc')
|
||||
htmldir = os.path.join(docdir, 'html')
|
||||
spawn(('make','--directory', docdir, 'html'), 1, self.verbose, self.dry_run)
|
||||
self.mkpath(self.build_html)
|
||||
copy_tree(htmldir, self.build_html)
|
||||
|
||||
def ensureHtml(self):
|
||||
if not os.path.exists(self.build_html):
|
||||
if self.download:
|
||||
self.downloadDocs()
|
||||
else:
|
||||
self.buildDocsFromSource()
|
||||
|
||||
def hackIndex(self):
|
||||
ind_html = 'index.html'
|
||||
#print 'self.build_dest =', self.build_dest
|
||||
hackedIndex = file(os.path.join(self.build_dest, ind_html),'w')
|
||||
origIndex = file(os.path.join(self.build_html,ind_html))
|
||||
r = re.compile('<style type="text/css">.*</style>', re.DOTALL)
|
||||
hackedIndex.write(r.sub('<META NAME="AppleTitle" CONTENT="Python Documentation">',origIndex.read()))
|
||||
|
||||
def hackFile(self,d,f):
|
||||
origPath = os.path.join(d,f)
|
||||
assert(origPath[:len(self.build_html)] == self.build_html)
|
||||
outPath = os.path.join(self.build_dest, d[len(self.build_html)+1:], f)
|
||||
(name, ext) = os.path.splitext(f)
|
||||
if os.path.isdir(origPath):
|
||||
self.mkpath(outPath)
|
||||
elif ext == '.html':
|
||||
if self.verbose: print 'hacking %s to %s' % (origPath,outPath)
|
||||
hackedFile = file(outPath, 'w')
|
||||
origFile = file(origPath,'r')
|
||||
hackedFile.write(self.r.sub('<dl><dt><dd>', origFile.read()))
|
||||
else:
|
||||
copy_file(origPath, outPath)
|
||||
|
||||
def hackHtml(self):
|
||||
self.r = re.compile('<dl><dd>')
|
||||
os.path.walk(self.build_html, self.visit, None)
|
||||
|
||||
def visit(self, dummy, dirname, filenames):
|
||||
for f in filenames:
|
||||
self.hackFile(dirname, f)
|
||||
|
||||
def makeHelpIndex(self):
|
||||
app = '/Developer/Applications/Apple Help Indexing Tool.app'
|
||||
self.spawn('open', '-a', app , self.build_dest)
|
||||
print "Please wait until Apple Help Indexing Tool finishes before installing"
|
||||
|
||||
def makeHelpIndex(self):
|
||||
app = HelpIndexingTool.HelpIndexingTool(start=1)
|
||||
app.open(Carbon.File.FSSpec(self.build_dest))
|
||||
sys.stderr.write("Waiting for Help Indexing Tool to start...")
|
||||
while 1:
|
||||
# This is bad design in the suite generation code!
|
||||
idle = app._get(HelpIndexingTool.Help_Indexing_Tool_Suite._Prop_idleStatus())
|
||||
time.sleep(10)
|
||||
if not idle: break
|
||||
sys.stderr.write(".")
|
||||
sys.stderr.write("\n")
|
||||
sys.stderr.write("Waiting for Help Indexing Tool to finish...")
|
||||
while 1:
|
||||
# This is bad design in the suite generation code!
|
||||
idle = app._get(HelpIndexingTool.Help_Indexing_Tool_Suite._Prop_idleStatus())
|
||||
time.sleep(10)
|
||||
if idle: break
|
||||
sys.stderr.write(".")
|
||||
sys.stderr.write("\n")
|
||||
|
||||
|
||||
def run(self):
|
||||
self.ensure_finalized()
|
||||
self.mkpath(self.build_base)
|
||||
self.ensureHtml()
|
||||
if not os.path.isdir(self.build_html):
|
||||
raise RuntimeError, \
|
||||
"Can't find source folder for documentation."
|
||||
self.mkpath(self.build_dest)
|
||||
if dep_util.newer(os.path.join(self.build_html,'index.html'), os.path.join(self.build_dest,'index.html')):
|
||||
self.mkpath(self.build_dest)
|
||||
self.hackHtml()
|
||||
self.hackIndex()
|
||||
self.makeHelpIndex()
|
||||
|
||||
class AHVDocInstall(Command):
|
||||
description = "install Apple Help Viewer html files"
|
||||
user_options = [('install-doc=', 'd',
|
||||
'directory to install HTML tree'),
|
||||
('root=', None,
|
||||
"install everything relative to this alternate root directory"),
|
||||
]
|
||||
|
||||
def initialize_options(self):
|
||||
self.build_dest = None
|
||||
self.install_doc = None
|
||||
self.prefix = None
|
||||
self.root = None
|
||||
|
||||
def finalize_options(self):
|
||||
self.set_undefined_options('install',
|
||||
('prefix', 'prefix'),
|
||||
('root', 'root'))
|
||||
# import pdb ; pdb.set_trace()
|
||||
build_cmd = self.get_finalized_command('build')
|
||||
if self.build_dest == None:
|
||||
build_cmd = self.get_finalized_command('build')
|
||||
self.build_dest = build_cmd.build_dest
|
||||
if self.install_doc == None:
|
||||
self.install_doc = os.path.join(self.prefix, DESTDIR)
|
||||
print 'INSTALL', self.build_dest, '->', self.install_doc
|
||||
|
||||
def run(self):
|
||||
self.finalize_options()
|
||||
self.ensure_finalized()
|
||||
print "Running Installer"
|
||||
instloc = self.install_doc
|
||||
if self.root:
|
||||
instloc = change_root(self.root, instloc)
|
||||
self.mkpath(instloc)
|
||||
copy_tree(self.build_dest, instloc)
|
||||
print "Installation complete"
|
||||
|
||||
def mungeVersion(infile, outfile):
|
||||
i = file(infile,'r')
|
||||
o = file(outfile,'w')
|
||||
o.write(re.sub('\$\(VERSION\)',sysconfig.get_config_var('VERSION'),i.read()))
|
||||
i.close()
|
||||
o.close()
|
||||
|
||||
def main():
|
||||
# turn off warnings when deprecated modules are imported
|
||||
## import warnings
|
||||
## warnings.filterwarnings("ignore",category=DeprecationWarning)
|
||||
setup(name = 'Documentation',
|
||||
version = '%d.%d' % sys.version_info[:2],
|
||||
cmdclass = {'install_data':AHVDocInstall, 'build':DocBuild},
|
||||
data_files = ['dummy'],
|
||||
)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -1,55 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>py</string>
|
||||
<string>pyw</string>
|
||||
</array>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>PythonSource.icns</string>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Python Script</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>pyc</string>
|
||||
<string>pyo</string>
|
||||
</array>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>PythonCompiled.icns</string>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Python Bytecode Document</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>IDLE</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>2.5, © 001-2006 Python Software Foundation</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>IDLE.icns</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.python.IDLE</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>IDLE</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.5</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2.5</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -1,54 +0,0 @@
|
|||
prefix=@prefix@
|
||||
CC=@CC@
|
||||
LD=@CC@
|
||||
BASECFLAGS=@BASECFLAGS@
|
||||
OPT=@OPT@
|
||||
CFLAGS=$(BASECFLAGS) $(OPT)
|
||||
LDFLAGS=@LDFLAGS@
|
||||
srcdir= @srcdir@
|
||||
VERSION= @VERSION@
|
||||
UNIVERSALSDK=@UNIVERSALSDK@
|
||||
builddir= ../../..
|
||||
|
||||
RUNSHARED= @RUNSHARED@
|
||||
BUILDEXE= @BUILDEXEEXT@
|
||||
BUILDPYTHON= ../../../python$(BUILDEXE)
|
||||
|
||||
# Deployment target selected during configure, to be checked
|
||||
# by distutils
|
||||
MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
|
||||
@EXPORT_MACOSX_DEPLOYMENT_TARGET@export MACOSX_DEPLOYMENT_TARGET
|
||||
|
||||
BUNDLEBULDER=$(srcdir)/../../../Lib/plat-mac/bundlebuilder.py
|
||||
|
||||
PYTHONAPPSDIR=/Applications/MacPython $(VERSION)
|
||||
|
||||
all: IDLE.app
|
||||
|
||||
install: IDLE.app $(srcdir)/config-main.def $(srcdir)/config-extensions.def
|
||||
test -d "$(DESTDIR)$(PYTHONAPPSDIR)" || mkdir -p "$(DESTDIR)$(PYTHONAPPSDIR)"
|
||||
-test -d "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app" && rm -r "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app"
|
||||
cp -PR IDLE.app "$(DESTDIR)$(PYTHONAPPSDIR)"
|
||||
touch "$(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app"
|
||||
cp $(srcdir)/config-main.def "$(DESTDIR)$(prefix)/lib/python$(VERSION)/idlelib/config-main.def"
|
||||
cp $(srcdir)/config-extensions.def "$(DESTDIR)$(prefix)/lib/python$(VERSION)/idlelib/config-extensions.def"
|
||||
|
||||
clean:
|
||||
rm -rf IDLE.app
|
||||
|
||||
IDLE.app: \
|
||||
$(srcdir)/../Icons/IDLE.icns $(srcdir)/idlemain.py \
|
||||
$(srcdir)/../Icons/PythonSource.icns \
|
||||
$(srcdir)/../Icons/PythonCompiled.icns
|
||||
rm -fr IDLE.app
|
||||
$(RUNSHARED) $(BUILDPYTHON) $(BUNDLEBULDER) \
|
||||
--builddir=. \
|
||||
--name=IDLE \
|
||||
--link-exec \
|
||||
--plist=$(srcdir)/Info.plist \
|
||||
--mainprogram=$(srcdir)/idlemain.py \
|
||||
--iconfile=$(srcdir)/../Icons/IDLE.icns \
|
||||
--resource=$(srcdir)/../Icons/PythonSource.icns \
|
||||
--resource=$(srcdir)/../Icons/PythonCompiled.icns \
|
||||
--python=$(prefix)/Resources/Python.app/Contents/MacOS/Python \
|
||||
build
|
|
@ -1,88 +0,0 @@
|
|||
# config-extensions.def
|
||||
#
|
||||
# IDLE reads several config files to determine user preferences. This
|
||||
# file is the default configuration file for IDLE extensions settings.
|
||||
#
|
||||
# Each extension must have at least one section, named after the extension
|
||||
# module. This section must contain an 'enable' item (=1 to enable the
|
||||
# extension, =0 to disable it), it may contain 'enable_editor' or 'enable_shell'
|
||||
# items, to apply it only to editor/shell windows, and may also contain any
|
||||
# other general configuration items for the extension.
|
||||
#
|
||||
# Each extension must define at least one section named ExtensionName_bindings
|
||||
# or ExtensionName_cfgBindings. If present, ExtensionName_bindings defines
|
||||
# virtual event bindings for the extension that are not user re-configurable.
|
||||
# If present, ExtensionName_cfgBindings defines virtual event bindings for the
|
||||
# extension that may be sensibly re-configured.
|
||||
#
|
||||
# If there are no keybindings for a menus' virtual events, include lines like
|
||||
# <<toggle-code-context>>= (See [CodeContext], below.)
|
||||
#
|
||||
# Currently it is necessary to manually modify this file to change extension
|
||||
# key bindings and default values. To customize, create
|
||||
# ~/.idlerc/config-extensions.cfg and append the appropriate customized
|
||||
# section(s). Those sections will override the defaults in this file.
|
||||
#
|
||||
# Note: If a keybinding is already in use when the extension is
|
||||
# loaded, the extension's virtual event's keybinding will be set to ''.
|
||||
#
|
||||
# See config-keys.def for notes on specifying keys and extend.txt for
|
||||
# information on creating IDLE extensions.
|
||||
|
||||
[FormatParagraph]
|
||||
enable=1
|
||||
[FormatParagraph_cfgBindings]
|
||||
format-paragraph=<Option-Key-q>
|
||||
|
||||
[AutoExpand]
|
||||
enable=1
|
||||
[AutoExpand_cfgBindings]
|
||||
expand-word=<Option-Key-slash>
|
||||
|
||||
[ZoomHeight]
|
||||
enable=1
|
||||
[ZoomHeight_cfgBindings]
|
||||
zoom-height=<Option-Key-0>
|
||||
|
||||
[ScriptBinding]
|
||||
enable=1
|
||||
[ScriptBinding_cfgBindings]
|
||||
run-module=<Key-F5>
|
||||
check-module=<Option-Key-x>
|
||||
|
||||
[CallTips]
|
||||
enable=1
|
||||
[CallTips_cfgBindings]
|
||||
force-open-calltip=<Control-Key-backslash>
|
||||
[CallTips_bindings]
|
||||
try-open-calltip=<KeyRelease-parenleft>
|
||||
refresh-calltip=<KeyRelease-parenright> <KeyRelease-0>
|
||||
|
||||
[ParenMatch]
|
||||
enable=1
|
||||
style= expression
|
||||
flash-delay= 500
|
||||
bell= 1
|
||||
[ParenMatch_cfgBindings]
|
||||
flash-paren=<Control-Key-0>
|
||||
[ParenMatch_bindings]
|
||||
paren-closed=<KeyRelease-parenright> <KeyRelease-bracketright> <KeyRelease-braceright>
|
||||
|
||||
[AutoComplete]
|
||||
enable=1
|
||||
popupwait=2000
|
||||
[AutoComplete_cfgBindings]
|
||||
force-open-completions=<Control-Key-space>
|
||||
[AutoComplete_bindings]
|
||||
autocomplete=<Key-Tab>
|
||||
try-open-completions=<KeyRelease-period> <KeyRelease-slash> <KeyRelease-backslash>
|
||||
|
||||
[CodeContext]
|
||||
enable=1
|
||||
enable_shell=0
|
||||
numlines=3
|
||||
visible=0
|
||||
bgcolor=LightGray
|
||||
fgcolor=Black
|
||||
[CodeContext_bindings]
|
||||
toggle-code-context=
|
|
@ -1,79 +0,0 @@
|
|||
# IDLE reads several config files to determine user preferences. This
|
||||
# file is the default config file for general idle settings.
|
||||
#
|
||||
# When IDLE starts, it will look in
|
||||
# the following two sets of files, in order:
|
||||
#
|
||||
# default configuration
|
||||
# ---------------------
|
||||
# config-main.def the default general config file
|
||||
# config-extensions.def the default extension config file
|
||||
# config-highlight.def the default highlighting config file
|
||||
# config-keys.def the default keybinding config file
|
||||
#
|
||||
# user configuration
|
||||
# -------------------
|
||||
# ~/.idlerc/config-main.cfg the user general config file
|
||||
# ~/.idlerc/config-extensions.cfg the user extension config file
|
||||
# ~/.idlerc/config-highlight.cfg the user highlighting config file
|
||||
# ~/.idlerc/config-keys.cfg the user keybinding config file
|
||||
#
|
||||
# On Windows2000 and Windows XP the .idlerc directory is at
|
||||
# Documents and Settings\<username>\.idlerc
|
||||
#
|
||||
# On Windows98 it is at c:\.idlerc
|
||||
#
|
||||
# Any options the user saves through the config dialog will be saved to
|
||||
# the relevant user config file. Reverting any general setting to the
|
||||
# default causes that entry to be wiped from the user file and re-read
|
||||
# from the default file. User highlighting themes or keybinding sets are
|
||||
# retained unless specifically deleted within the config dialog. Choosing
|
||||
# one of the default themes or keysets just applies the relevant settings
|
||||
# from the default file.
|
||||
#
|
||||
# Additional help sources are listed in the [HelpFiles] section and must be
|
||||
# viewable by a web browser (or the Windows Help viewer in the case of .chm
|
||||
# files). These sources will be listed on the Help menu. The pattern is
|
||||
# <sequence_number = menu item;/path/to/help/source>
|
||||
# You can't use a semi-colon in a menu item or path. The path will be platform
|
||||
# specific because of path separators, drive specs etc.
|
||||
#
|
||||
# It is best to use the Configuration GUI to set up additional help sources!
|
||||
# Example:
|
||||
#1 = My Extra Help Source;/usr/share/doc/foo/index.html
|
||||
#2 = Another Help Source;/path/to/another.pdf
|
||||
|
||||
[General]
|
||||
editor-on-startup= 0
|
||||
autosave= 0
|
||||
print-command-posix=lpr %s
|
||||
print-command-win=start /min notepad /p %s
|
||||
delete-exitfunc= 1
|
||||
|
||||
[EditorWindow]
|
||||
width= 80
|
||||
height= 40
|
||||
font= courier
|
||||
font-size= 10
|
||||
font-bold= 0
|
||||
encoding= none
|
||||
|
||||
[FormatParagraph]
|
||||
paragraph=70
|
||||
|
||||
[Indent]
|
||||
use-spaces= 1
|
||||
num-spaces= 4
|
||||
|
||||
[Theme]
|
||||
default= 1
|
||||
name= IDLE Classic
|
||||
|
||||
[Keys]
|
||||
default= 1
|
||||
name= IDLE Classic Mac
|
||||
|
||||
[History]
|
||||
cyclic=1
|
||||
|
||||
[HelpFiles]
|
|
@ -1,27 +0,0 @@
|
|||
"""
|
||||
Bootstrap script for IDLE as an application bundle.
|
||||
"""
|
||||
import sys, os
|
||||
|
||||
from idlelib.PyShell import main
|
||||
|
||||
# Change the current directory the user's home directory, that way we'll get
|
||||
# a more useful default location in the open/save dialogs.
|
||||
os.chdir(os.path.expanduser('~/Documents'))
|
||||
|
||||
|
||||
# Make sure sys.executable points to the python interpreter inside the
|
||||
# framework, instead of at the helper executable inside the application
|
||||
# bundle (the latter works, but doesn't allow access to the window server)
|
||||
sys.executable = os.path.join(sys.prefix, 'bin', 'python')
|
||||
|
||||
# Look for the -psn argument that the launcher adds and remove it, it will
|
||||
# only confuse the IDLE startup code.
|
||||
for idx, value in enumerate(sys.argv):
|
||||
if value.startswith('-psn_'):
|
||||
del sys.argv[idx]
|
||||
break
|
||||
|
||||
#argvemulator.ArgvCollector().mainloop()
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -1,30 +0,0 @@
|
|||
{\rtf1\mac\ansicpg10000\cocoartf100
|
||||
{\fonttbl\f0\fswiss\fcharset77 Helvetica-Bold;\f1\fswiss\fcharset77 Helvetica;}
|
||||
{\colortbl;\red255\green255\blue255;}
|
||||
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural
|
||||
|
||||
\f0\b\fs24 \cf0 Engineering:
|
||||
\f1\b0 \
|
||||
Jack Jansen\
|
||||
\
|
||||
|
||||
\f0\b Human Interface Design:
|
||||
\f1\b0 \
|
||||
Jack Jansen\
|
||||
\
|
||||
|
||||
\f0\b Testing:
|
||||
\f1\b0 \
|
||||
Jack Jansen\
|
||||
Pythonmac-SIG@python.org\
|
||||
\
|
||||
|
||||
\f0\b Documentation:
|
||||
\f1\b0 \
|
||||
Missing\
|
||||
\
|
||||
|
||||
\f0\b With special thanks to:
|
||||
\f1\b0 \
|
||||
Guido, of course\
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
IBClasses = (
|
||||
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
|
||||
{
|
||||
ACTIONS = {showPreferences = id; };
|
||||
CLASS = MyAppDelegate;
|
||||
LANGUAGE = ObjC;
|
||||
SUPERCLASS = NSObject;
|
||||
}
|
||||
);
|
||||
IBVersion = 1;
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
|
||||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>99 33 356 240 0 0 800 578 </string>
|
||||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>29</key>
|
||||
<string>82 396 318 44 0 0 800 578 </string>
|
||||
</dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>263.2</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>29</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>5S66</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -1,26 +0,0 @@
|
|||
{
|
||||
IBClasses = (
|
||||
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
|
||||
{
|
||||
ACTIONS = {"do_apply" = id; "do_cancel" = id; "do_reset" = id; "do_run" = id; };
|
||||
CLASS = MyDocument;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
commandline = NSTextField;
|
||||
debug = NSButton;
|
||||
honourhashbang = NSButton;
|
||||
inspect = NSButton;
|
||||
interpreter = NSTextField;
|
||||
nosite = NSButton;
|
||||
optimize = NSButton;
|
||||
others = NSTextField;
|
||||
scriptargs = NSTextField;
|
||||
tabs = NSButton;
|
||||
verbose = NSButton;
|
||||
"with_terminal" = NSButton;
|
||||
};
|
||||
SUPERCLASS = NSDocument;
|
||||
}
|
||||
);
|
||||
IBVersion = 1;
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>398 60 356 240 0 0 1024 746 </string>
|
||||
<key>IBFramework Version</key>
|
||||
<string>291.0</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>5</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>6L60</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -1,26 +0,0 @@
|
|||
{
|
||||
IBClasses = (
|
||||
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
|
||||
{
|
||||
ACTIONS = {"do_apply" = id; "do_filetype" = id; "do_reset" = id; };
|
||||
CLASS = PreferencesWindowController;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
commandline = NSTextField;
|
||||
debug = NSButton;
|
||||
filetype = NSPopUpButton;
|
||||
honourhashbang = NSButton;
|
||||
inspect = NSButton;
|
||||
interpreter = NSTextField;
|
||||
nosite = NSButton;
|
||||
optimize = NSButton;
|
||||
others = NSTextField;
|
||||
tabs = NSButton;
|
||||
verbose = NSButton;
|
||||
"with_terminal" = NSButton;
|
||||
};
|
||||
SUPERCLASS = NSWindowController;
|
||||
}
|
||||
);
|
||||
IBVersion = 1;
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>565 235 519 534 0 0 1280 1002 </string>
|
||||
<key>IBFramework Version</key>
|
||||
<string>364.0</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>5</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>7H63</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -1,64 +0,0 @@
|
|||
//
|
||||
// FileSettings.h
|
||||
// PythonLauncher
|
||||
//
|
||||
// Created by Jack Jansen on Sun Jul 21 2002.
|
||||
// Copyright (c) 2002 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@protocol FileSettingsSource
|
||||
- (NSString *) interpreter;
|
||||
- (BOOL) honourhashbang;
|
||||
- (BOOL) debug;
|
||||
- (BOOL) verbose;
|
||||
- (BOOL) inspect;
|
||||
- (BOOL) optimize;
|
||||
- (BOOL) nosite;
|
||||
- (BOOL) tabs;
|
||||
- (NSString *) others;
|
||||
- (BOOL) with_terminal;
|
||||
- (NSString *) scriptargs;
|
||||
@end
|
||||
|
||||
@interface FileSettings : NSObject <FileSettingsSource>
|
||||
{
|
||||
NSString *interpreter; // The pathname of the interpreter to use
|
||||
NSArray *interpreters; // List of known interpreters
|
||||
BOOL honourhashbang; // #! line overrides interpreter
|
||||
BOOL debug; // -d option: debug parser
|
||||
BOOL verbose; // -v option: verbose import
|
||||
BOOL inspect; // -i option: interactive mode after script
|
||||
BOOL optimize; // -O option: optimize bytecode
|
||||
BOOL nosite; // -S option: don't import site.py
|
||||
BOOL tabs; // -t option: warn about inconsistent tabs
|
||||
NSString *others; // other options
|
||||
NSString *scriptargs; // script arguments (not for preferences)
|
||||
BOOL with_terminal; // Run in terminal window
|
||||
|
||||
FileSettings *origsource;
|
||||
NSString *prefskey;
|
||||
}
|
||||
|
||||
+ (id)getDefaultsForFileType: (NSString *)filetype;
|
||||
+ (id)getFactorySettingsForFileType: (NSString *)filetype;
|
||||
+ (id)newSettingsForFileType: (NSString *)filetype;
|
||||
|
||||
//- (id)init;
|
||||
- (id)initForFileType: (NSString *)filetype;
|
||||
- (id)initForFSDefaultFileType: (NSString *)filetype;
|
||||
- (id)initForDefaultFileType: (NSString *)filetype;
|
||||
//- (id)initWithFileSettings: (FileSettings *)source;
|
||||
|
||||
- (void)updateFromSource: (id <FileSettingsSource>)source;
|
||||
- (NSString *)commandLineForScript: (NSString *)script;
|
||||
|
||||
//- (void)applyFactorySettingsForFileType: (NSString *)filetype;
|
||||
//- (void)saveDefaults;
|
||||
//- (void)applyUserDefaults: (NSString *)filetype;
|
||||
- (void)applyValuesFromDict: (NSDictionary *)dict;
|
||||
- (void)reset;
|
||||
- (NSArray *) interpreters;
|
||||
|
||||
@end
|
|
@ -1,298 +0,0 @@
|
|||
//
|
||||
// FileSettings.m
|
||||
// PythonLauncher
|
||||
//
|
||||
// Created by Jack Jansen on Sun Jul 21 2002.
|
||||
// Copyright (c) 2002 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import "FileSettings.h"
|
||||
|
||||
@implementation FileSettings
|
||||
|
||||
+ (id)getFactorySettingsForFileType: (NSString *)filetype
|
||||
{
|
||||
static FileSettings *fsdefault_py, *fsdefault_pyw, *fsdefault_pyc;
|
||||
FileSettings **curdefault;
|
||||
|
||||
if ([filetype isEqualToString: @"Python Script"]) {
|
||||
curdefault = &fsdefault_py;
|
||||
} else if ([filetype isEqualToString: @"Python GUI Script"]) {
|
||||
curdefault = &fsdefault_pyw;
|
||||
} else if ([filetype isEqualToString: @"Python Bytecode Document"]) {
|
||||
curdefault = &fsdefault_pyc;
|
||||
} else {
|
||||
NSLog(@"Funny File Type: %@\n", filetype);
|
||||
curdefault = &fsdefault_py;
|
||||
filetype = @"Python Script";
|
||||
}
|
||||
if (!*curdefault) {
|
||||
*curdefault = [[FileSettings new] initForFSDefaultFileType: filetype];
|
||||
}
|
||||
return *curdefault;
|
||||
}
|
||||
|
||||
+ (id)getDefaultsForFileType: (NSString *)filetype
|
||||
{
|
||||
static FileSettings *default_py, *default_pyw, *default_pyc;
|
||||
FileSettings **curdefault;
|
||||
|
||||
if ([filetype isEqualToString: @"Python Script"]) {
|
||||
curdefault = &default_py;
|
||||
} else if ([filetype isEqualToString: @"Python GUI Script"]) {
|
||||
curdefault = &default_pyw;
|
||||
} else if ([filetype isEqualToString: @"Python Bytecode Document"]) {
|
||||
curdefault = &default_pyc;
|
||||
} else {
|
||||
NSLog(@"Funny File Type: %@\n", filetype);
|
||||
curdefault = &default_py;
|
||||
filetype = @"Python Script";
|
||||
}
|
||||
if (!*curdefault) {
|
||||
*curdefault = [[FileSettings new] initForDefaultFileType: filetype];
|
||||
}
|
||||
return *curdefault;
|
||||
}
|
||||
|
||||
+ (id)newSettingsForFileType: (NSString *)filetype
|
||||
{
|
||||
FileSettings *cur;
|
||||
|
||||
cur = [FileSettings new];
|
||||
[cur initForFileType: filetype];
|
||||
return [cur retain];
|
||||
}
|
||||
|
||||
- (id)initWithFileSettings: (FileSettings *)source
|
||||
{
|
||||
self = [super init];
|
||||
if (!self) return self;
|
||||
|
||||
interpreter = [source->interpreter retain];
|
||||
honourhashbang = source->honourhashbang;
|
||||
debug = source->debug;
|
||||
verbose = source->verbose;
|
||||
inspect = source->inspect;
|
||||
optimize = source->optimize;
|
||||
nosite = source->nosite;
|
||||
tabs = source->tabs;
|
||||
others = [source->others retain];
|
||||
scriptargs = [source->scriptargs retain];
|
||||
with_terminal = source->with_terminal;
|
||||
prefskey = source->prefskey;
|
||||
if (prefskey) [prefskey retain];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)initForFileType: (NSString *)filetype
|
||||
{
|
||||
FileSettings *defaults;
|
||||
|
||||
defaults = [FileSettings getDefaultsForFileType: filetype];
|
||||
self = [self initWithFileSettings: defaults];
|
||||
origsource = [defaults retain];
|
||||
return self;
|
||||
}
|
||||
|
||||
//- (id)init
|
||||
//{
|
||||
// self = [self initForFileType: @"Python Script"];
|
||||
// return self;
|
||||
//}
|
||||
|
||||
- (id)initForFSDefaultFileType: (NSString *)filetype
|
||||
{
|
||||
int i;
|
||||
NSString *filename;
|
||||
NSDictionary *dict;
|
||||
static NSDictionary *factorySettings;
|
||||
|
||||
self = [super init];
|
||||
if (!self) return self;
|
||||
|
||||
if (factorySettings == NULL) {
|
||||
NSBundle *bdl = [NSBundle mainBundle];
|
||||
NSString *path = [ bdl pathForResource: @"factorySettings"
|
||||
ofType: @"plist"];
|
||||
factorySettings = [[NSDictionary dictionaryWithContentsOfFile:
|
||||
path] retain];
|
||||
if (factorySettings == NULL) {
|
||||
NSLog(@"Missing %@", path);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
dict = [factorySettings objectForKey: filetype];
|
||||
if (dict == NULL) {
|
||||
NSLog(@"factorySettings.plist misses file type \"%@\"", filetype);
|
||||
interpreter = [@"no default found" retain];
|
||||
return NULL;
|
||||
}
|
||||
[self applyValuesFromDict: dict];
|
||||
interpreters = [dict objectForKey: @"interpreter_list"];
|
||||
interpreter = NULL;
|
||||
for (i=0; i < [interpreters count]; i++) {
|
||||
filename = [interpreters objectAtIndex: i];
|
||||
filename = [filename stringByExpandingTildeInPath];
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath: filename]) {
|
||||
interpreter = [filename retain];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (interpreter == NULL)
|
||||
interpreter = [@"no default found" retain];
|
||||
origsource = NULL;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)applyUserDefaults: (NSString *)filetype
|
||||
{
|
||||
NSUserDefaults *defaults;
|
||||
NSDictionary *dict;
|
||||
|
||||
defaults = [NSUserDefaults standardUserDefaults];
|
||||
dict = [defaults dictionaryForKey: filetype];
|
||||
if (!dict)
|
||||
return;
|
||||
[self applyValuesFromDict: dict];
|
||||
}
|
||||
|
||||
- (id)initForDefaultFileType: (NSString *)filetype
|
||||
{
|
||||
FileSettings *fsdefaults;
|
||||
|
||||
fsdefaults = [FileSettings getFactorySettingsForFileType: filetype];
|
||||
self = [self initWithFileSettings: fsdefaults];
|
||||
if (!self) return self;
|
||||
interpreters = [fsdefaults->interpreters retain];
|
||||
scriptargs = [@"" retain];
|
||||
[self applyUserDefaults: filetype];
|
||||
prefskey = [filetype retain];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)reset
|
||||
{
|
||||
if (origsource) {
|
||||
[self updateFromSource: origsource];
|
||||
} else {
|
||||
FileSettings *fsdefaults;
|
||||
fsdefaults = [FileSettings getFactorySettingsForFileType: prefskey];
|
||||
[self updateFromSource: fsdefaults];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)updateFromSource: (id <FileSettingsSource>)source
|
||||
{
|
||||
interpreter = [[source interpreter] retain];
|
||||
honourhashbang = [source honourhashbang];
|
||||
debug = [source debug];
|
||||
verbose = [source verbose];
|
||||
inspect = [source inspect];
|
||||
optimize = [source optimize];
|
||||
nosite = [source nosite];
|
||||
tabs = [source tabs];
|
||||
others = [[source others] retain];
|
||||
scriptargs = [[source scriptargs] retain];
|
||||
with_terminal = [source with_terminal];
|
||||
// And if this is a user defaults object we also save the
|
||||
// values
|
||||
if (!origsource) {
|
||||
NSUserDefaults *defaults;
|
||||
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
interpreter, @"interpreter",
|
||||
[NSNumber numberWithBool: honourhashbang], @"honourhashbang",
|
||||
[NSNumber numberWithBool: debug], @"debug",
|
||||
[NSNumber numberWithBool: verbose], @"verbose",
|
||||
[NSNumber numberWithBool: inspect], @"inspect",
|
||||
[NSNumber numberWithBool: optimize], @"optimize",
|
||||
[NSNumber numberWithBool: nosite], @"nosite",
|
||||
[NSNumber numberWithBool: nosite], @"nosite",
|
||||
others, @"others",
|
||||
scriptargs, @"scriptargs",
|
||||
[NSNumber numberWithBool: with_terminal], @"with_terminal",
|
||||
nil];
|
||||
defaults = [NSUserDefaults standardUserDefaults];
|
||||
[defaults setObject: dict forKey: prefskey];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)applyValuesFromDict: (NSDictionary *)dict
|
||||
{
|
||||
id value;
|
||||
|
||||
value = [dict objectForKey: @"interpreter"];
|
||||
if (value) interpreter = [value retain];
|
||||
value = [dict objectForKey: @"honourhashbang"];
|
||||
if (value) honourhashbang = [value boolValue];
|
||||
value = [dict objectForKey: @"debug"];
|
||||
if (value) debug = [value boolValue];
|
||||
value = [dict objectForKey: @"verbose"];
|
||||
if (value) verbose = [value boolValue];
|
||||
value = [dict objectForKey: @"inspect"];
|
||||
if (value) inspect = [value boolValue];
|
||||
value = [dict objectForKey: @"optimize"];
|
||||
if (value) optimize = [value boolValue];
|
||||
value = [dict objectForKey: @"nosite"];
|
||||
if (value) nosite = [value boolValue];
|
||||
value = [dict objectForKey: @"nosite"];
|
||||
if (value) tabs = [value boolValue];
|
||||
value = [dict objectForKey: @"others"];
|
||||
if (value) others = [value retain];
|
||||
value = [dict objectForKey: @"scriptargs"];
|
||||
if (value) scriptargs = [value retain];
|
||||
value = [dict objectForKey: @"with_terminal"];
|
||||
if (value) with_terminal = [value boolValue];
|
||||
}
|
||||
|
||||
- (NSString *)commandLineForScript: (NSString *)script
|
||||
{
|
||||
NSString *cur_interp = NULL;
|
||||
char hashbangbuf[1024];
|
||||
FILE *fp;
|
||||
char *p;
|
||||
|
||||
if (honourhashbang &&
|
||||
(fp=fopen([script cString], "r")) &&
|
||||
fgets(hashbangbuf, sizeof(hashbangbuf), fp) &&
|
||||
strncmp(hashbangbuf, "#!", 2) == 0 &&
|
||||
(p=strchr(hashbangbuf, '\n'))) {
|
||||
*p = '\0';
|
||||
p = hashbangbuf + 2;
|
||||
while (*p == ' ') p++;
|
||||
cur_interp = [NSString stringWithCString: p];
|
||||
}
|
||||
if (!cur_interp)
|
||||
cur_interp = interpreter;
|
||||
|
||||
return [NSString stringWithFormat:
|
||||
@"\"%@\"%s%s%s%s%s%s %@ \"%@\" %@ %s",
|
||||
cur_interp,
|
||||
debug?" -d":"",
|
||||
verbose?" -v":"",
|
||||
inspect?" -i":"",
|
||||
optimize?" -O":"",
|
||||
nosite?" -S":"",
|
||||
tabs?" -t":"",
|
||||
others,
|
||||
script,
|
||||
scriptargs,
|
||||
with_terminal? "&& echo Exit status: $? && exit 1" : " &"];
|
||||
}
|
||||
|
||||
- (NSArray *) interpreters { return interpreters;};
|
||||
|
||||
// FileSettingsSource protocol
|
||||
- (NSString *) interpreter { return interpreter;};
|
||||
- (BOOL) honourhashbang { return honourhashbang; };
|
||||
- (BOOL) debug { return debug;};
|
||||
- (BOOL) verbose { return verbose;};
|
||||
- (BOOL) inspect { return inspect;};
|
||||
- (BOOL) optimize { return optimize;};
|
||||
- (BOOL) nosite { return nosite;};
|
||||
- (BOOL) tabs { return tabs;};
|
||||
- (NSString *) others { return others;};
|
||||
- (NSString *) scriptargs { return scriptargs;};
|
||||
- (BOOL) with_terminal { return with_terminal;};
|
||||
|
||||
@end
|
|
@ -1,65 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>py</string>
|
||||
<string>pyw</string>
|
||||
</array>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>PythonSource.icns</string>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Python Script</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
<key>NSDocumentClass</key>
|
||||
<string>MyDocument</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeExtensions</key>
|
||||
<array>
|
||||
<string>pyc</string>
|
||||
<string>pyo</string>
|
||||
</array>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>PythonCompiled.icns</string>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Python Bytecode Document</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
<key>NSDocumentClass</key>
|
||||
<string>MyDocument</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>PythonLauncher</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>2.5, © 001-2006 Python Software Foundation</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>PythonLauncher.icns</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.python.PythonLauncher</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Python Launcher</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.5</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>PytL</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2.5</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -1,78 +0,0 @@
|
|||
CC=@CC@
|
||||
LD=@CC@
|
||||
BASECFLAGS=@BASECFLAGS@
|
||||
OPT=@OPT@
|
||||
CFLAGS=$(BASECFLAGS) $(OPT)
|
||||
LDFLAGS=@LDFLAGS@
|
||||
srcdir= @srcdir@
|
||||
VERSION= @VERSION@
|
||||
UNIVERSALSDK=@UNIVERSALSDK@
|
||||
builddir= ../../..
|
||||
|
||||
RUNSHARED= @RUNSHARED@
|
||||
BUILDEXE= @BUILDEXEEXT@
|
||||
BUILDPYTHON= ../../../python$(BUILDEXE)
|
||||
|
||||
# Deployment target selected during configure, to be checked
|
||||
# by distutils
|
||||
MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
|
||||
@EXPORT_MACOSX_DEPLOYMENT_TARGET@export MACOSX_DEPLOYMENT_TARGET
|
||||
|
||||
BUNDLEBULDER=$(srcdir)/../../../Lib/plat-mac/bundlebuilder.py
|
||||
|
||||
PYTHONAPPSDIR=/Applications/MacPython $(VERSION)
|
||||
OBJECTS=FileSettings.o MyAppDelegate.o MyDocument.o PreferencesWindowController.o doscript.o main.o
|
||||
|
||||
all: Python\ Launcher.app
|
||||
|
||||
install: Python\ Launcher.app
|
||||
test -d "$(DESTDIR)$(PYTHONAPPSDIR)" || mkdir -p "$(DESTDIR)$(PYTHONAPPSDIR)"
|
||||
-test -d "$(DESTDIR)$(PYTHONAPPSDIR)/Python Launcher.app" && rm -r "$(DESTDIR)$(PYTHONAPPSDIR)/Python Launcher.app"
|
||||
cp -r "Python Launcher.app" "$(DESTDIR)$(PYTHONAPPSDIR)"
|
||||
touch "$(DESTDIR)$(PYTHONAPPSDIR)/Python Launcher.app"
|
||||
|
||||
clean:
|
||||
rm -f *.o "Python Launcher"
|
||||
rm -rf "Python Launcher.app"
|
||||
|
||||
Python\ Launcher.app: \
|
||||
Python\ Launcher $(srcdir)/../Icons/PythonLauncher.icns \
|
||||
$(srcdir)/../Icons/PythonSource.icns \
|
||||
$(srcdir)/../Icons/PythonCompiled.icns \
|
||||
$(srcdir)/factorySettings.plist
|
||||
rm -fr "Python Launcher.app"
|
||||
$(RUNSHARED) $(BUILDPYTHON) $(BUNDLEBULDER) \
|
||||
--builddir=. \
|
||||
--name="Python Launcher" \
|
||||
--executable="Python Launcher" \
|
||||
--iconfile=$(srcdir)/../Icons/PythonLauncher.icns \
|
||||
--bundle-id=org.python.PythonLauncher \
|
||||
--resource=$(srcdir)/../Icons/PythonSource.icns \
|
||||
--resource=$(srcdir)/../Icons/PythonCompiled.icns \
|
||||
--resource=$(srcdir)/English.lproj \
|
||||
--resource=$(srcdir)/factorySettings.plist \
|
||||
--plist=$(srcdir)/Info.plist \
|
||||
build
|
||||
find "Python Launcher.app" -name '.svn' -print0 | xargs -0 rm -r
|
||||
|
||||
|
||||
FileSettings.o: $(srcdir)/FileSettings.m
|
||||
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/FileSettings.m
|
||||
|
||||
MyAppDelegate.o: $(srcdir)/MyAppDelegate.m
|
||||
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/MyAppDelegate.m
|
||||
|
||||
MyDocument.o: $(srcdir)/MyDocument.m
|
||||
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/MyDocument.m
|
||||
|
||||
PreferencesWindowController.o: $(srcdir)/PreferencesWindowController.m
|
||||
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/PreferencesWindowController.m
|
||||
|
||||
doscript.o: $(srcdir)/doscript.m
|
||||
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/doscript.m
|
||||
|
||||
main.o: $(srcdir)/main.m
|
||||
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/main.m
|
||||
|
||||
Python\ Launcher: $(OBJECTS)
|
||||
$(CC) $(LDFLAGS) -o "Python Launcher" $(OBJECTS) -framework AppKit -framework Carbon
|
|
@ -1,15 +0,0 @@
|
|||
/* MyAppDelegate */
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface MyAppDelegate : NSObject
|
||||
{
|
||||
BOOL initial_action_done;
|
||||
BOOL should_terminate;
|
||||
}
|
||||
- (id)init;
|
||||
- (IBAction)showPreferences:(id)sender;
|
||||
- (BOOL)shouldShowUI;
|
||||
- (BOOL)shouldTerminate;
|
||||
- (void)testFileTypeBinding;
|
||||
@end
|
|
@ -1,96 +0,0 @@
|
|||
#import "MyAppDelegate.h"
|
||||
#import "PreferencesWindowController.h"
|
||||
#import <Carbon/Carbon.h>
|
||||
#import <ApplicationServices/ApplicationServices.h>
|
||||
|
||||
@implementation MyAppDelegate
|
||||
|
||||
- (id)init
|
||||
{
|
||||
self = [super init];
|
||||
initial_action_done = NO;
|
||||
should_terminate = NO;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (IBAction)showPreferences:(id)sender
|
||||
{
|
||||
[PreferencesWindowController getPreferencesWindow];
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)notification
|
||||
{
|
||||
// Test that the file mappings are correct
|
||||
[self testFileTypeBinding];
|
||||
// If we were opened because of a file drag or doubleclick
|
||||
// we've set initial_action_done in shouldShowUI
|
||||
// Otherwise we open a preferences dialog.
|
||||
if (!initial_action_done) {
|
||||
initial_action_done = YES;
|
||||
[self showPreferences: self];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)shouldShowUI
|
||||
{
|
||||
// if this call comes before applicationDidFinishLaunching: we
|
||||
// should terminate immedeately after starting the script.
|
||||
if (!initial_action_done)
|
||||
should_terminate = YES;
|
||||
initial_action_done = YES;
|
||||
if( GetCurrentKeyModifiers() & optionKey )
|
||||
return YES;
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)shouldTerminate
|
||||
{
|
||||
return should_terminate;
|
||||
}
|
||||
|
||||
- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)testFileTypeBinding
|
||||
{
|
||||
NSURL *ourUrl;
|
||||
OSStatus err;
|
||||
FSRef appRef;
|
||||
NSURL *appUrl;
|
||||
static NSString *extensions[] = { @"py", @"pyw", @"pyc", NULL};
|
||||
NSString **ext_p;
|
||||
int i;
|
||||
|
||||
if ([[NSUserDefaults standardUserDefaults] boolForKey: @"SkipFileBindingTest"])
|
||||
return;
|
||||
ourUrl = [NSURL fileURLWithPath: [[NSBundle mainBundle] bundlePath]];
|
||||
for( ext_p = extensions; *ext_p; ext_p++ ) {
|
||||
err = LSGetApplicationForInfo(
|
||||
kLSUnknownType,
|
||||
kLSUnknownCreator,
|
||||
(CFStringRef)*ext_p,
|
||||
kLSRolesViewer,
|
||||
&appRef,
|
||||
(CFURLRef *)&appUrl);
|
||||
if (err || ![appUrl isEqual: ourUrl] ) {
|
||||
i = NSRunAlertPanel(@"File type binding",
|
||||
@"PythonLauncher is not the default application for all " \
|
||||
@"Python script types. You should fix this with the " \
|
||||
@"Finder's \"Get Info\" command.\n\n" \
|
||||
@"See \"Changing the application that opens a file\" in " \
|
||||
@"Mac Help for details.",
|
||||
@"OK",
|
||||
@"Don't show this warning again",
|
||||
NULL);
|
||||
if ( i == 0 ) { // Don't show again
|
||||
[[NSUserDefaults standardUserDefaults]
|
||||
setObject:@"YES" forKey:@"SkipFileBindingTest"];
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
|
@ -1,41 +0,0 @@
|
|||
//
|
||||
// MyDocument.h
|
||||
// PythonLauncher
|
||||
//
|
||||
// Created by Jack Jansen on Fri Jul 19 2002.
|
||||
// Copyright (c) 2002 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#import "FileSettings.h"
|
||||
|
||||
@interface MyDocument : NSDocument <FileSettingsSource>
|
||||
{
|
||||
IBOutlet NSTextField *interpreter;
|
||||
IBOutlet NSButton *honourhashbang;
|
||||
IBOutlet NSButton *debug;
|
||||
IBOutlet NSButton *verbose;
|
||||
IBOutlet NSButton *inspect;
|
||||
IBOutlet NSButton *optimize;
|
||||
IBOutlet NSButton *nosite;
|
||||
IBOutlet NSButton *tabs;
|
||||
IBOutlet NSTextField *others;
|
||||
IBOutlet NSButton *with_terminal;
|
||||
IBOutlet NSTextField *scriptargs;
|
||||
IBOutlet NSTextField *commandline;
|
||||
|
||||
NSString *script;
|
||||
NSString *filetype;
|
||||
FileSettings *settings;
|
||||
}
|
||||
|
||||
- (IBAction)do_run:(id)sender;
|
||||
- (IBAction)do_cancel:(id)sender;
|
||||
- (IBAction)do_reset:(id)sender;
|
||||
- (IBAction)do_apply:(id)sender;
|
||||
|
||||
- (void)controlTextDidChange:(NSNotification *)aNotification;
|
||||
|
||||
@end
|
|
@ -1,175 +0,0 @@
|
|||
//
|
||||
// MyDocument.m
|
||||
// PythonLauncher
|
||||
//
|
||||
// Created by Jack Jansen on Fri Jul 19 2002.
|
||||
// Copyright (c) 2002 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MyDocument.h"
|
||||
#import "MyAppDelegate.h"
|
||||
#import "doscript.h"
|
||||
|
||||
@implementation MyDocument
|
||||
|
||||
- (id)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
|
||||
// Add your subclass-specific initialization here.
|
||||
// If an error occurs here, send a [self dealloc] message and return nil.
|
||||
script = [@"<no script>.py" retain];
|
||||
filetype = [@"Python Script" retain];
|
||||
settings = NULL;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString *)windowNibName
|
||||
{
|
||||
// Override returning the nib file name of the document
|
||||
// If you need to use a subclass of NSWindowController or if your document supports multiple NSWindowControllers, you should remove this method and override -makeWindowControllers instead.
|
||||
return @"MyDocument";
|
||||
}
|
||||
|
||||
- (void)close
|
||||
{
|
||||
NSApplication *app = [NSApplication sharedApplication];
|
||||
[super close];
|
||||
if ([[app delegate] shouldTerminate])
|
||||
[app terminate: self];
|
||||
}
|
||||
|
||||
- (void)load_defaults
|
||||
{
|
||||
// if (settings) [settings release];
|
||||
settings = [FileSettings newSettingsForFileType: filetype];
|
||||
}
|
||||
|
||||
- (void)update_display
|
||||
{
|
||||
// [[self window] setTitle: script];
|
||||
|
||||
[interpreter setStringValue: [settings interpreter]];
|
||||
[honourhashbang setState: [settings honourhashbang]];
|
||||
[debug setState: [settings debug]];
|
||||
[verbose setState: [settings verbose]];
|
||||
[inspect setState: [settings inspect]];
|
||||
[optimize setState: [settings optimize]];
|
||||
[nosite setState: [settings nosite]];
|
||||
[tabs setState: [settings tabs]];
|
||||
[others setStringValue: [settings others]];
|
||||
[scriptargs setStringValue: [settings scriptargs]];
|
||||
[with_terminal setState: [settings with_terminal]];
|
||||
|
||||
[commandline setStringValue: [settings commandLineForScript: script]];
|
||||
}
|
||||
|
||||
- (void)update_settings
|
||||
{
|
||||
[settings updateFromSource: self];
|
||||
}
|
||||
|
||||
- (BOOL)run
|
||||
{
|
||||
const char *cmdline;
|
||||
int sts;
|
||||
|
||||
cmdline = [[settings commandLineForScript: script] cString];
|
||||
if ([settings with_terminal]) {
|
||||
sts = doscript(cmdline);
|
||||
} else {
|
||||
sts = system(cmdline);
|
||||
}
|
||||
if (sts) {
|
||||
NSLog(@"Exit status: %d\n", sts);
|
||||
return NO;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)windowControllerDidLoadNib:(NSWindowController *) aController
|
||||
{
|
||||
[super windowControllerDidLoadNib:aController];
|
||||
// Add any code here that need to be executed once the windowController has loaded the document's window.
|
||||
[self load_defaults];
|
||||
[self update_display];
|
||||
}
|
||||
|
||||
- (NSData *)dataRepresentationOfType:(NSString *)aType
|
||||
{
|
||||
// Insert code here to write your document from the given data. You can also choose to override -fileWrapperRepresentationOfType: or -writeToFile:ofType: instead.
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (BOOL)readFromFile:(NSString *)fileName ofType:(NSString *)type;
|
||||
{
|
||||
// Insert code here to read your document from the given data. You can also choose to override -loadFileWrapperRepresentation:ofType: or -readFromFile:ofType: instead.
|
||||
BOOL show_ui;
|
||||
|
||||
// ask the app delegate whether we should show the UI or not.
|
||||
show_ui = [[[NSApplication sharedApplication] delegate] shouldShowUI];
|
||||
[script release];
|
||||
script = [fileName retain];
|
||||
[filetype release];
|
||||
filetype = [type retain];
|
||||
// if (settings) [settings release];
|
||||
settings = [FileSettings newSettingsForFileType: filetype];
|
||||
if (show_ui) {
|
||||
[self update_display];
|
||||
return YES;
|
||||
} else {
|
||||
[self run];
|
||||
[self close];
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)do_run:(id)sender
|
||||
{
|
||||
[self update_settings];
|
||||
[self update_display];
|
||||
if ([self run])
|
||||
[self close];
|
||||
}
|
||||
|
||||
- (IBAction)do_cancel:(id)sender
|
||||
{
|
||||
[self close];
|
||||
}
|
||||
|
||||
|
||||
- (IBAction)do_reset:(id)sender
|
||||
{
|
||||
[settings reset];
|
||||
[self update_display];
|
||||
}
|
||||
|
||||
- (IBAction)do_apply:(id)sender
|
||||
{
|
||||
[self update_settings];
|
||||
[self update_display];
|
||||
}
|
||||
|
||||
// FileSettingsSource protocol
|
||||
- (NSString *) interpreter { return [interpreter stringValue];};
|
||||
- (BOOL) honourhashbang { return [honourhashbang state];};
|
||||
- (BOOL) debug { return [debug state];};
|
||||
- (BOOL) verbose { return [verbose state];};
|
||||
- (BOOL) inspect { return [inspect state];};
|
||||
- (BOOL) optimize { return [optimize state];};
|
||||
- (BOOL) nosite { return [nosite state];};
|
||||
- (BOOL) tabs { return [tabs state];};
|
||||
- (NSString *) others { return [others stringValue];};
|
||||
- (NSString *) scriptargs { return [scriptargs stringValue];};
|
||||
- (BOOL) with_terminal { return [with_terminal state];};
|
||||
|
||||
// Delegates
|
||||
- (void)controlTextDidChange:(NSNotification *)aNotification
|
||||
{
|
||||
[self update_settings];
|
||||
[self update_display];
|
||||
};
|
||||
|
||||
@end
|
|
@ -1,26 +0,0 @@
|
|||
{
|
||||
IBClasses = (
|
||||
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
|
||||
{
|
||||
ACTIONS = {"do_apply" = id; "do_filetype" = id; "do_reset" = id; };
|
||||
CLASS = PreferencesWindowController;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
commandline = NSTextField;
|
||||
debug = NSButton;
|
||||
filetype = NSPopUpButton;
|
||||
honourhashbang = NSButton;
|
||||
inspect = NSButton;
|
||||
interpreter = NSTextField;
|
||||
nosite = NSButton;
|
||||
optimize = NSButton;
|
||||
others = NSTextField;
|
||||
tabs = NSButton;
|
||||
verbose = NSButton;
|
||||
"with_terminal" = NSButton;
|
||||
};
|
||||
SUPERCLASS = NSWindowController;
|
||||
}
|
||||
);
|
||||
IBVersion = 1;
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>565 235 519 534 0 0 1280 1002 </string>
|
||||
<key>IBFramework Version</key>
|
||||
<string>364.0</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>5</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>7H63</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -1,38 +0,0 @@
|
|||
/* PreferencesWindowController */
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#import "FileSettings.h"
|
||||
|
||||
@interface PreferencesWindowController : NSWindowController <FileSettingsSource>
|
||||
{
|
||||
IBOutlet NSPopUpButton *filetype;
|
||||
IBOutlet NSComboBox *interpreter;
|
||||
IBOutlet NSButton *honourhashbang;
|
||||
IBOutlet NSButton *debug;
|
||||
IBOutlet NSButton *verbose;
|
||||
IBOutlet NSButton *inspect;
|
||||
IBOutlet NSButton *optimize;
|
||||
IBOutlet NSButton *nosite;
|
||||
IBOutlet NSButton *tabs;
|
||||
IBOutlet NSTextField *others;
|
||||
IBOutlet NSButton *with_terminal;
|
||||
IBOutlet NSTextField *commandline;
|
||||
|
||||
FileSettings *settings;
|
||||
}
|
||||
|
||||
+ getPreferencesWindow;
|
||||
|
||||
- (IBAction)do_reset:(id)sender;
|
||||
- (IBAction)do_apply:(id)sender;
|
||||
- (IBAction)do_filetype:(id)sender;
|
||||
|
||||
- (void)controlTextDidChange:(NSNotification *)aNotification;
|
||||
|
||||
- (unsigned int)comboBox:(NSComboBox *)aComboBox indexOfItemWithStringValue:(NSString *)aString;
|
||||
- (id)comboBox:(NSComboBox *)aComboBox objectValueForItemAtIndex:(int)index;
|
||||
- (int)numberOfItemsInComboBox:(NSComboBox *)aComboBox;
|
||||
|
||||
|
||||
@end
|
|
@ -1,121 +0,0 @@
|
|||
#import "PreferencesWindowController.h"
|
||||
|
||||
@implementation PreferencesWindowController
|
||||
|
||||
+ getPreferencesWindow
|
||||
{
|
||||
static PreferencesWindowController *_singleton;
|
||||
|
||||
if (!_singleton)
|
||||
_singleton = [[PreferencesWindowController alloc] init];
|
||||
[_singleton showWindow: _singleton];
|
||||
return _singleton;
|
||||
}
|
||||
|
||||
- (id) init
|
||||
{
|
||||
self = [self initWithWindowNibName: @"PreferenceWindow"];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)load_defaults
|
||||
{
|
||||
NSString *title = [filetype titleOfSelectedItem];
|
||||
|
||||
settings = [FileSettings getDefaultsForFileType: title];
|
||||
}
|
||||
|
||||
- (void)update_display
|
||||
{
|
||||
// [[self window] setTitle: script];
|
||||
|
||||
[interpreter reloadData];
|
||||
[interpreter setStringValue: [settings interpreter]];
|
||||
[honourhashbang setState: [settings honourhashbang]];
|
||||
[debug setState: [settings debug]];
|
||||
[verbose setState: [settings verbose]];
|
||||
[inspect setState: [settings inspect]];
|
||||
[optimize setState: [settings optimize]];
|
||||
[nosite setState: [settings nosite]];
|
||||
[tabs setState: [settings tabs]];
|
||||
[others setStringValue: [settings others]];
|
||||
[with_terminal setState: [settings with_terminal]];
|
||||
// Not scriptargs, it isn't for preferences
|
||||
|
||||
[commandline setStringValue: [settings commandLineForScript: @"<your script here>"]];
|
||||
}
|
||||
|
||||
- (void) windowDidLoad
|
||||
{
|
||||
[super windowDidLoad];
|
||||
[self load_defaults];
|
||||
[self update_display];
|
||||
}
|
||||
|
||||
- (void)update_settings
|
||||
{
|
||||
[settings updateFromSource: self];
|
||||
}
|
||||
|
||||
- (IBAction)do_filetype:(id)sender
|
||||
{
|
||||
[self load_defaults];
|
||||
[self update_display];
|
||||
}
|
||||
|
||||
- (IBAction)do_reset:(id)sender
|
||||
{
|
||||
[settings reset];
|
||||
[self update_display];
|
||||
}
|
||||
|
||||
- (IBAction)do_apply:(id)sender
|
||||
{
|
||||
[self update_settings];
|
||||
[self update_display];
|
||||
}
|
||||
|
||||
// FileSettingsSource protocol
|
||||
- (NSString *) interpreter { return [interpreter stringValue];};
|
||||
- (BOOL) honourhashbang { return [honourhashbang state]; };
|
||||
- (BOOL) debug { return [debug state];};
|
||||
- (BOOL) verbose { return [verbose state];};
|
||||
- (BOOL) inspect { return [inspect state];};
|
||||
- (BOOL) optimize { return [optimize state];};
|
||||
- (BOOL) nosite { return [nosite state];};
|
||||
- (BOOL) tabs { return [tabs state];};
|
||||
- (NSString *) others { return [others stringValue];};
|
||||
- (BOOL) with_terminal { return [with_terminal state];};
|
||||
- (NSString *) scriptargs { return @"";};
|
||||
|
||||
// Delegates
|
||||
- (void)controlTextDidChange:(NSNotification *)aNotification
|
||||
{
|
||||
[self update_settings];
|
||||
[self update_display];
|
||||
};
|
||||
|
||||
// NSComboBoxDataSource protocol
|
||||
- (unsigned int)comboBox:(NSComboBox *)aComboBox indexOfItemWithStringValue:(NSString *)aString
|
||||
{
|
||||
NSArray *interp_list = [settings interpreters];
|
||||
unsigned int rv = [interp_list indexOfObjectIdenticalTo: aString];
|
||||
return rv;
|
||||
}
|
||||
|
||||
- (id)comboBox:(NSComboBox *)aComboBox objectValueForItemAtIndex:(int)index
|
||||
{
|
||||
NSArray *interp_list = [settings interpreters];
|
||||
id rv = [interp_list objectAtIndex: index];
|
||||
return rv;
|
||||
}
|
||||
|
||||
- (int)numberOfItemsInComboBox:(NSComboBox *)aComboBox
|
||||
{
|
||||
NSArray *interp_list = [settings interpreters];
|
||||
int rv = [interp_list count];
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
@end
|
|
@ -1,12 +0,0 @@
|
|||
/*
|
||||
* doscript.h
|
||||
* PythonLauncher
|
||||
*
|
||||
* Created by Jack Jansen on Wed Jul 31 2002.
|
||||
* Copyright (c) 2002 __MyCompanyName__. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <Carbon/Carbon.h>
|
||||
|
||||
extern int doscript(const char *command);
|
|
@ -1,118 +0,0 @@
|
|||
/*
|
||||
* doscript.c
|
||||
* PythonLauncher
|
||||
*
|
||||
* Created by Jack Jansen on Wed Jul 31 2002.
|
||||
* Copyright (c) 2002 __MyCompanyName__. All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <ApplicationServices/ApplicationServices.h>
|
||||
#import "doscript.h"
|
||||
|
||||
/* I assume I could pick these up from somewhere, but where... */
|
||||
#define CREATOR 'trmx'
|
||||
|
||||
#define ACTIVATE_CMD 'misc'
|
||||
#define ACTIVATE_SUITE 'actv'
|
||||
|
||||
#define DOSCRIPT_CMD 'dosc'
|
||||
#define DOSCRIPT_SUITE 'core'
|
||||
#define WITHCOMMAND 'cmnd'
|
||||
|
||||
/* ... and there's probably also a better way to do this... */
|
||||
#define START_TERMINAL "/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal &"
|
||||
|
||||
extern int
|
||||
doscript(const char *command)
|
||||
{
|
||||
OSErr err;
|
||||
AppleEvent theAEvent, theReply;
|
||||
AEAddressDesc terminalAddress;
|
||||
AEDesc commandDesc;
|
||||
OSType terminalCreator = CREATOR;
|
||||
|
||||
/* set up locals */
|
||||
AECreateDesc(typeNull, NULL, 0, &theAEvent);
|
||||
AECreateDesc(typeNull, NULL, 0, &terminalAddress);
|
||||
AECreateDesc(typeNull, NULL, 0, &theReply);
|
||||
AECreateDesc(typeNull, NULL, 0, &commandDesc);
|
||||
|
||||
/* create the "activate" event for Terminal */
|
||||
err = AECreateDesc(typeApplSignature, (Ptr) &terminalCreator,
|
||||
sizeof(terminalCreator), &terminalAddress);
|
||||
if (err != noErr) {
|
||||
NSLog(@"doscript: AECreateDesc: error %d\n", err);
|
||||
goto bail;
|
||||
}
|
||||
err = AECreateAppleEvent(ACTIVATE_SUITE, ACTIVATE_CMD,
|
||||
&terminalAddress, kAutoGenerateReturnID,
|
||||
kAnyTransactionID, &theAEvent);
|
||||
|
||||
if (err != noErr) {
|
||||
NSLog(@"doscript: AECreateAppleEvent(activate): error %d\n", err);
|
||||
goto bail;
|
||||
}
|
||||
/* send the event */
|
||||
err = AESend(&theAEvent, &theReply, kAEWaitReply,
|
||||
kAENormalPriority, kAEDefaultTimeout, NULL, NULL);
|
||||
if ( err == -600 ) {
|
||||
int count=10;
|
||||
/* If it failed with "no such process" try to start Terminal */
|
||||
err = system(START_TERMINAL);
|
||||
if ( err ) {
|
||||
NSLog(@"doscript: system(): %s\n", strerror(errno));
|
||||
goto bail;
|
||||
}
|
||||
do {
|
||||
sleep(1);
|
||||
/* send the event again */
|
||||
err = AESend(&theAEvent, &theReply, kAEWaitReply,
|
||||
kAENormalPriority, kAEDefaultTimeout, NULL, NULL);
|
||||
} while (err == -600 && --count > 0);
|
||||
if ( err == -600 )
|
||||
NSLog(@"doscript: Could not activate Terminal\n");
|
||||
}
|
||||
if (err != noErr) {
|
||||
NSLog(@"doscript: AESend(activate): error %d\n", err);
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/* create the "doscript with command" event for Terminal */
|
||||
err = AECreateAppleEvent(DOSCRIPT_SUITE, DOSCRIPT_CMD,
|
||||
&terminalAddress, kAutoGenerateReturnID,
|
||||
kAnyTransactionID, &theAEvent);
|
||||
if (err != noErr) {
|
||||
NSLog(@"doscript: AECreateAppleEvent(doscript): error %d\n", err);
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/* add the command to the apple event */
|
||||
err = AECreateDesc(typeChar, command, strlen(command), &commandDesc);
|
||||
if (err != noErr) {
|
||||
NSLog(@"doscript: AECreateDesc(command): error %d\n", err);
|
||||
goto bail;
|
||||
}
|
||||
err = AEPutParamDesc(&theAEvent, WITHCOMMAND, &commandDesc);
|
||||
if (err != noErr) {
|
||||
NSLog(@"doscript: AEPutParamDesc: error %d\n", err);
|
||||
goto bail;
|
||||
}
|
||||
|
||||
/* send the command event to Terminal.app */
|
||||
err = AESend(&theAEvent, &theReply, kAEWaitReply,
|
||||
kAENormalPriority, kAEDefaultTimeout, NULL, NULL);
|
||||
|
||||
if (err != noErr) {
|
||||
NSLog(@"doscript: AESend(docommand): error %d\n", err);
|
||||
goto bail;
|
||||
}
|
||||
/* clean up and leave */
|
||||
bail:
|
||||
AEDisposeDesc(&commandDesc);
|
||||
AEDisposeDesc(&theAEvent);
|
||||
AEDisposeDesc(&terminalAddress);
|
||||
AEDisposeDesc(&theReply);
|
||||
return err;
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Python GUI Script</key>
|
||||
<dict>
|
||||
<key>debug</key>
|
||||
<false/>
|
||||
<key>inspect</key>
|
||||
<false/>
|
||||
<key>interpreter_list</key>
|
||||
<array>
|
||||
<string>/usr/local/bin/pythonw</string>
|
||||
<string>/usr/bin/pythonw</string>
|
||||
<string>/sw/bin/pythonw</string>
|
||||
</array>
|
||||
<key>honourhashbang</key>
|
||||
<false/>
|
||||
<key>nosite</key>
|
||||
<false/>
|
||||
<key>optimize</key>
|
||||
<false/>
|
||||
<key>others</key>
|
||||
<string></string>
|
||||
<key>verbose</key>
|
||||
<false/>
|
||||
<key>with_terminal</key>
|
||||
<false/>
|
||||
</dict>
|
||||
<key>Python Script</key>
|
||||
<dict>
|
||||
<key>debug</key>
|
||||
<false/>
|
||||
<key>inspect</key>
|
||||
<false/>
|
||||
<key>interpreter_list</key>
|
||||
<array>
|
||||
<string>/usr/local/bin/pythonw</string>
|
||||
<string>/usr/local/bin/python</string>
|
||||
<string>/usr/bin/pythonw</string>
|
||||
<string>/usr/bin/python</string>
|
||||
<string>/sw/bin/pythonw</string>
|
||||
<string>/sw/bin/python</string>
|
||||
</array>
|
||||
<key>honourhashbang</key>
|
||||
<false/>
|
||||
<key>nosite</key>
|
||||
<false/>
|
||||
<key>optimize</key>
|
||||
<false/>
|
||||
<key>others</key>
|
||||
<string></string>
|
||||
<key>verbose</key>
|
||||
<false/>
|
||||
<key>with_terminal</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>Python Bytecode Document</key>
|
||||
<dict>
|
||||
<key>debug</key>
|
||||
<false/>
|
||||
<key>inspect</key>
|
||||
<false/>
|
||||
<key>interpreter_list</key>
|
||||
<array>
|
||||
<string>/usr/local/bin/pythonw</string>
|
||||
<string>/usr/local/bin/python</string>
|
||||
<string>/usr/bin/pythonw</string>
|
||||
<string>/usr/bin/python</string>
|
||||
<string>/sw/bin/pythonw</string>
|
||||
<string>/sw/bin/python</string>
|
||||
</array>
|
||||
<key>honourhashbang</key>
|
||||
<false/>
|
||||
<key>nosite</key>
|
||||
<false/>
|
||||
<key>optimize</key>
|
||||
<false/>
|
||||
<key>others</key>
|
||||
<string></string>
|
||||
<key>verbose</key>
|
||||
<false/>
|
||||
<key>with_terminal</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
|
@ -1,17 +0,0 @@
|
|||
//
|
||||
// main.m
|
||||
// PythonLauncher
|
||||
//
|
||||
// Created by Jack Jansen on Fri Jul 19 2002.
|
||||
// Copyright (c) 2002 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
char *home = getenv("HOME");
|
||||
if (home) chdir(home);
|
||||
return NSApplicationMain(argc, argv);
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
/*
|
||||
* This wrapper program executes a python executable hidden inside an
|
||||
* application bundle inside the Python framework. This is needed to run
|
||||
* GUI code: some GUI API's don't work unless the program is inside an
|
||||
* application bundle.
|
||||
*/
|
||||
#include <unistd.h>
|
||||
#include <err.h>
|
||||
|
||||
static char Python[] = PYTHONWEXECUTABLE;
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
argv[0] = Python;
|
||||
execv(Python, argv);
|
||||
err(1, "execv: %s", Python);
|
||||
/* NOTREACHED */
|
||||
}
|
|
@ -1,118 +0,0 @@
|
|||
"""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 gestalt
|
||||
|
||||
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, 0755)
|
||||
fp = open(filename, 'w')
|
||||
fp.write(SCRIPT % compiler)
|
||||
fp.close()
|
||||
os.chmod(filename, 0755)
|
||||
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 gestalt.gestalt('sysv') < 0x1030:
|
||||
print 'fixapplepython23: no fix needed on MacOSX < 10.3'
|
||||
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)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 138 B After Width: | Height: | Size: 138 B |