Remove some old MacPython files that are no longer relevant.
|
@ -38,12 +38,7 @@ STRIPFLAG=-s
|
|||
CPMAC=/Developer/Tools/CpMac
|
||||
|
||||
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)/Resources/app/Resources/English.lproj/Documentation
|
||||
DOCINDEX=$(DOCDIR)/"Documentation idx"
|
||||
APPSUBDIRS=MacOS Resources
|
||||
CACHERSRC=$(srcdir)/scripts/cachersrc.py
|
||||
compileall=$(srcdir)/../Lib/compileall.py
|
||||
|
||||
|
@ -161,9 +156,6 @@ install_PythonLauncher:
|
|||
cd PythonLauncher && make install DESTDIR=$(DESTDIR)
|
||||
|
||||
install_Python:
|
||||
@if test ! -f $(DOCINDEX); then \
|
||||
echo WARNING: you should run Apple Help Indexing Tool on $(DOCDIR); \
|
||||
fi
|
||||
@for i in "$(PYTHONAPPSDIR)" "$(APPINSTALLDIR)" "$(APPINSTALLDIR)/Contents"; do \
|
||||
if test ! -d "$(DESTDIR)$$i"; then \
|
||||
echo "Creating directory $(DESTDIR)$$i"; \
|
||||
|
|
Before Width: | Height: | Size: 5.9 KiB |
|
@ -1,69 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
|
||||
<title>What is MacPython?</title>
|
||||
<meta name="generator" content="BBEdit 6.5.3">
|
||||
<link rel="SHORTCUT ICON" href="pythonsmall.gif">
|
||||
<META NAME="AppleIcon" CONTENT="pythonsmall.gif">
|
||||
</head>
|
||||
<body>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="python.gif" width="128" height="128" align="top" alt="">
|
||||
</td>
|
||||
<td>
|
||||
<h1>MacPython Community</h1>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr>
|
||||
|
||||
<h2>Web Sites</h2>
|
||||
|
||||
<p>The MacPython homepage, <a href="http://www.cwi.nl/~jack/macpython.html">
|
||||
www.cwi.nl/~jack/macpython.html</a>
|
||||
is where you can find installers, documents, links to useful packages and more.
|
||||
And, of course,
|
||||
<a href="http://www.python.org">www.python.org</a> has a much larger collection
|
||||
of material on Python that is not Mac-specific.</p>
|
||||
|
||||
<h2>News groups and Mailing lists</h2>
|
||||
|
||||
<p>There are a lot of mailing lists on Python. Some of the more interesting
|
||||
ones are:</p>
|
||||
<ul>
|
||||
<li><a href="mailto:python-help@python.org">python-help@python.org</a> where
|
||||
you can send questions for individual support. Please check the websites mentioned
|
||||
above first, though!</li>
|
||||
<li>The <a href="news:comp.lang.python">comp.lang.python</a> newsgroup for general
|
||||
discussion. Also available as a
|
||||
<a href="http://www.python.org/mailman/listinfo/python-list">mailing list</a>.</li>
|
||||
<li>The <a href="news:comp.lang.python.announce">comp.lang.python.announce</a>
|
||||
newsgroup for announcements. Low-volume and moderated. Also available as a
|
||||
<a href="http://www.python.org/mailman/listinfo/python-announce-list">mailing list</a>.</li>
|
||||
<li>Last but not least, the <a href="http://www.python.org/sigs/pythonmac-sig/">pythonmac-sig</a>
|
||||
mailing list is specifically for MacPython. Discussions on the implementation of new
|
||||
features, but beginners questions are welcome too.</li>
|
||||
</ul>
|
||||
|
||||
<p>In addition there are Python <a href="http://www.python.org/sigs/">Special Interest Group</a>
|
||||
mailing lists on a wide variety of topics such as image processing, numerical algorithms
|
||||
and more.</p>
|
||||
|
||||
<h2>More</h2>
|
||||
|
||||
<p>An index of conferences, Wiki's, bookshops and more can be found at the
|
||||
<a href="http://www.python.org/psa/">Community</a> section of the Python website.</p>
|
||||
|
||||
<p>If you find a bug you are kindly requested to report it, preferrably through the
|
||||
automatic bug tracker at <a href="http://www.python.org">www.python.org</a></p>
|
||||
|
||||
<p>If you want to become an active developer you are very welcome! Join the
|
||||
pythonmac-sig mailing list mentioned above, and read the
|
||||
<a href="http://www.python.org/dev/">Developer</a> section on the Python website.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,21 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
|
||||
<title>Python Language Documentation</title>
|
||||
<meta name="generator" content="BBEdit 6.5.3">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Python Language and runtime documentation</h1>
|
||||
|
||||
<p>This volume of documentation is rather big (17 Megabytes) and contains
|
||||
a tutorial, full description of the Python library (all the modules
|
||||
and packages included), formal description of the language and more.</p>
|
||||
|
||||
<p>You can <a href="http://www.python.org/doc">view it online</a>, where
|
||||
you can also download PDFs for printing, or you can download and install it
|
||||
through the <a href="../packman.html">Package Manager</a> for viewing and
|
||||
searching via Apple Help Viewer.</p>
|
||||
</body>
|
||||
</html>
|
|
@ -1,36 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
|
||||
<title>Python and the Finder</title>
|
||||
<meta name="generator" content="BBEdit 6.5.3">
|
||||
<link rel="SHORTCUT ICON" href="pythonsmall.gif">
|
||||
<META NAME="AppleIcon" CONTENT="pythonsmall.gif">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Running Python scripts from the Finder</h1>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="python.gif" width="128" height="128" align="top" alt="">
|
||||
</td>
|
||||
<td>
|
||||
<p>The application PythonLauncher will start a Python interpreter
|
||||
when you drop a Python source file onto it, any file with a <tt>.py</tt>
|
||||
or <tt>.pyw</tt> extension. If you set PythonLauncher as the default
|
||||
application to open a file
|
||||
(<a href="help:search=Changing%20the%20application%20that%20opens%20a%20file bookID=Mac%20Help">
|
||||
tell me more</a>) this also works when you double click a Python script.</p>
|
||||
|
||||
<p>PythonLauncher has preferences per filetype for selecting
|
||||
the interpreter to use, and how to launch it: in a Terminal window
|
||||
or not, etc. Holding the Option key while launching your script will
|
||||
bring up a window that allows changing these settings for a single
|
||||
run. </p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr>
|
||||
</body>
|
||||
</html>
|
|
@ -1,54 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
|
||||
<title>Creating a User Interface with MacPython</title>
|
||||
<meta name="generator" content="BBEdit 6.5.3">
|
||||
<link rel="SHORTCUT ICON" href="pythonsmall.gif">
|
||||
<META NAME="AppleIcon" CONTENT="pythonsmall.gif">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Creating a User Interface with MacPython</h1>
|
||||
|
||||
<p>There are a number of packages that allow creation of a user interface
|
||||
for your Python code, each of which has its own merits:</p>
|
||||
|
||||
<ul>
|
||||
<li> The Carbon package gives low-level access to the old Macintosh toolbox
|
||||
calls for windows, events, dialogs and more. The <tt>FrameWork</tt> module
|
||||
wraps these in a minimal framework. For documentation see the Macintosh
|
||||
Library section of the <a href="doc/index.html">Python Language and runtime
|
||||
documentation</a> and the Human Interface Toolbox section of
|
||||
<a href="help:openbook=Carbon">Apple's Carbon Documentation</a>.
|
||||
This solution is compatible with MacPython-OS9.</li>
|
||||
<li> The <tt>W</tt> framework is built on top of this, and easier to use.
|
||||
The MacPython IDE uses W. Some documentation is available on
|
||||
<a href="http://www.nevada.edu/~cwebster/Python/index.html">Corran Webster's website</a>.
|
||||
Compatible with MacPython-OS9.</li>
|
||||
</ul>
|
||||
|
||||
<p>For new work, however, one of the following packages may be better suited.
|
||||
They may be available out of the box in this distribution, otherwise you
|
||||
can install them through the <a href="packman.html">Package Manager</a>:</p>
|
||||
|
||||
<ul>
|
||||
<li> <a href="http://pyobjc.sourceforge.net/">PyObjC</a> allows complete access to Cocoa.
|
||||
In technical terms it is a
|
||||
bidirectional bridge between Python and Objectve-C, similar to Apple's Java
|
||||
bridge. Probably the best choice for Mac OS X-only applications, but at the
|
||||
time of this writing PyObjC is still in beta.</li>
|
||||
|
||||
<li> <a href="http://wxpython.sourceforge.net/">wxPython</a> gives Python programs
|
||||
access to the wxWindows GUI toolkit. Many people consider this
|
||||
the best open source cross-platform GUI solution available today.</li>
|
||||
|
||||
<li> Tkinter is the oldest cross-platform GUI toolkit for Python, bridging Python
|
||||
to Tcl/Tk. If you install AquaTk it creates a native user interface on Mac OS X.
|
||||
Documented in the Library section, Tkinter subsection of the
|
||||
<a href="doc/index.html">Python Language and runtime documentation</a>. Tkinter
|
||||
is not available for MacPython-OS9.</li>
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
</html>
|
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 15 KiB |
|
@ -1,222 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>One Day of MacPython IDE Toying</title>
|
||||
<link rel="SHORTCUT ICON" href="../pythonsmall.gif">
|
||||
<META NAME="AppleIcon" CONTENT="../pythonsmall.gif">
|
||||
</head>
|
||||
<body bgcolor="#ffffff">
|
||||
<h1>One Day of MacPython IDE Toying</h1>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="IDE.gif" alt="">
|
||||
</td>
|
||||
<td>
|
||||
<p>This document gives a very basic introduction to the
|
||||
MacPython <b>I</b>ntegrated <b>D</b>evelopment <b>E</b>nvironment (IDE) on Mac OS. It was
|
||||
written specifically for MacPython 2.3 on Mac OS X, but most of
|
||||
it is applicable to MacPython-OS9 too. It is based on
|
||||
<a href="http://www-hkn.eecs.berkeley.edu/~dyoo/python/idle_intro/">"One
|
||||
Day of IDLE Toying"</a> by Danny Yoo, which you should read if
|
||||
you want to use the cross-platform IDLE Python development
|
||||
environment.</p>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr>
|
||||
<br style="page-break-after: always">
|
||||
|
||||
<p>Ok, let's assume that we've already installed Python. (If not, we can
|
||||
visit: <a href="http://www.cwi.nl/~jack/macpython.html">http://www.cwi.nl/~jack/macpython.html</a>
|
||||
or <a href="http://python.org">http://python.org</a>
|
||||
and download the most recent Python interpreter. Get the Mac OSX binary
|
||||
installer.) The first thing we'd like to do is actually start running it!
|
||||
We can do this by opening up the IDE, which should be in Applications
|
||||
under the newly-created MacPython program folder: </p><p><img
|
||||
src="loading_ide.gif" border=1 alt="image of IDE icon"></p>
|
||||
|
||||
<hr><br style="page-break-after: always">
|
||||
|
||||
<p>The IDE starts up and shows an interactive window: </p>
|
||||
<p><img src="new_ide_window.gif" alt="image of new window"></p>
|
||||
|
||||
<p>If the window does not show up (because you have run the IDE before
|
||||
and closed it: it remembers that between runs) open it with the <tt>Windows->Python Interactive</tt>
|
||||
menu entry. </p>
|
||||
|
||||
<p>This is the interactive window to the IDE, it allows us to enter
|
||||
commands directly into Python, and as soon as we enter a command,
|
||||
Python will execute it and spit its result back to us. We'll be
|
||||
using this interactive window a lot when we're exploring Python: it's
|
||||
very nice because we get back our results immediately. If it helps,
|
||||
we can think of it as a very powerful calculator.</p>
|
||||
|
||||
<hr><br style="page-break-after: always">
|
||||
|
||||
<p>Let's try something now! As per tradition, let's get Python to say
|
||||
the immortal words, "Hello World". <img src="hello_world.gif"
|
||||
border=1 alt="image of hello world program"></p> <p>Those '<tt>>>></tt>' signs act as a prompt
|
||||
for us: Python is ready to read in a new command by giving us that
|
||||
visual cue. Also, we notice that as we enter commands, Python will
|
||||
give us its output immediately.
|
||||
</p>
|
||||
|
||||
<hr><br style="page-break-after: always">
|
||||
|
||||
<p>Ok, this seems pretty simple enough. Let's try a few more
|
||||
commands. If we look below:</p>
|
||||
|
||||
<p><img src="simple_commands.gif" border=1 alt="image of command window"></p>
|
||||
|
||||
<p>we'll see the result of running a few more commands. Don't worry
|
||||
too much about knowing the exact rules for making programs yet: the
|
||||
idea is that we can experiment with Python by typing in commands. If
|
||||
things don't work, then we can correct the mistake, and try it
|
||||
again.</p>
|
||||
|
||||
<p>If you got to this point, you now know enough to start playing
|
||||
around with Python! Crack open one of the tutorials from the <a
|
||||
href="http://python.org/doc/Newbies.html">Python For Beginners</a> web
|
||||
page, and start exploring with the interpreter. No time limit here. *grin*</p>
|
||||
|
||||
<hr><br style="page-break-after: always">
|
||||
|
||||
<p>Now that we've paddled long enough, we might be asking: ok, this is
|
||||
neat, but if we close down Python and start it up again, how do we get
|
||||
the computer to remember what we typed?</p>
|
||||
|
||||
<p>The solution is a little subtle: we can't directly save what's in
|
||||
the interpreter window, because it will include both our commands and
|
||||
the system's responses. What we'd like is to make a prepared file,
|
||||
with just our own commands, and to be able to save that file as a
|
||||
document. When we're in the mood, we can later open that file and
|
||||
"run" Python over it, saving us the time of retyping the whole
|
||||
thing over again.</p>
|
||||
|
||||
<p>Let's try this. First, let's start with a clean slate by opening
|
||||
up a new window.</p>
|
||||
|
||||
<p><img src="making_new_window.gif" border=1 alt="image of making new window"></p>
|
||||
|
||||
<p>Here's the result of that menu command:</p>
|
||||
|
||||
<p><img src="new_window_made.gif" border=1 alt="image of new window"></p>
|
||||
|
||||
<p>We notice that there's nothing in this new window. What this means
|
||||
is that this file is purely for our commands: Python won't interject
|
||||
with its own responses as we enter the program, that is, not until we
|
||||
tell it to. This is called an edit window, and it is very similar
|
||||
to edit windows in other editors such as TextEdit or BBEdit.</p>
|
||||
|
||||
<hr><br style="page-break-after: always">
|
||||
|
||||
<p>What we wanted to do before was save some of the stuff we had
|
||||
tried out on the interpreter window. Let's do that by typing (or
|
||||
copy/pasting) those commands into our edit window.</p>
|
||||
<p><img src="entering_in_new_window.gif" border=1 alt="image of entering commands"></p>
|
||||
|
||||
<p>Ok, we're done with copying and pasting.
|
||||
One big thing to notice
|
||||
is that we're careful to get rid of the "<tt>>>></tt>"
|
||||
prompts because they're not really part of our program. The
|
||||
interpreter uses them just to tell us that we're in the interpreter,
|
||||
but now that we're editing in a separate file, we can remove the
|
||||
artifacts that the interpreter introduces.
|
||||
I have added
|
||||
an extra empty print statement so our output ends with a newline.
|
||||
</p>
|
||||
|
||||
<hr><br style="page-break-after: always">
|
||||
|
||||
<p>Let's save the file now. The Save command is located under the <tt>File</tt> menu:</p>
|
||||
<p><img src="saving_edited_file.gif" border=1 alt="image of saving file"></p>
|
||||
|
||||
|
||||
<hr><br style="page-break-after: always">
|
||||
|
||||
<p>Now that we've saved the program, how do we run the program? Use the
|
||||
Run All button at the top of the editing window, or the equivalent
|
||||
menu command <tt>Python->Run Window</tt>. The output will appear in a new
|
||||
window called Output Window. </p>
|
||||
|
||||
<p>By the way, one thing to notice is that I made a typo: I didn't
|
||||
quite copy exactly what I had entered in the interpreter window
|
||||
before. Does this affect things?</p>
|
||||
|
||||
<p><img src="syntax_error.gif" border=1 alt="image of syntax error"></p>
|
||||
|
||||
<p>Ooops. Here is an example of what Python calls a "syntax error".
|
||||
Python sees that we made a typo, and warns us to take a much closer
|
||||
look at our program. The designers of Python feel that having the
|
||||
system point out the error is better than trying to guess at what the
|
||||
programmer meant. Press the Edit button and you will be brought to
|
||||
the trouble spot. </p>
|
||||
|
||||
<p>Python is often perceptive enough to direct us toward the problem,
|
||||
and in this case, it's telling us that we forgot to put something at
|
||||
the end of this line. In this case, we need to add a
|
||||
quotation mark at the end. Let's add that in now.</p>
|
||||
|
||||
<p>Other errors, which usually occur later, when your program has
|
||||
already done something, result in a different dialog that allows you
|
||||
to look at variables and such in addition to showing you where
|
||||
the error occurred. </p>
|
||||
|
||||
<hr><br style="page-break-after: always">
|
||||
|
||||
<p>Ok, let's say that we fixed that silly typo. Let's try to run the
|
||||
program again. This gives us a new window, the Output window, showing
|
||||
the output of our program:</p>
|
||||
<p><img src="output_window.gif" border=1 alt="image of output window"></p>
|
||||
|
||||
<hr><br style="page-break-after: always">
|
||||
|
||||
<p>As we play with Python, we'll find ourselves "switching modes"
|
||||
between the Interpreter window and the edit window. However,
|
||||
if we try anything more complicated than two or three lines it
|
||||
is often a good idea to work in an edit window. Align
|
||||
your edit and output window such that you can see them at the same time.</p>
|
||||
|
||||
<p>This is pretty much all we need to know about the MacPython IDE to actually do
|
||||
interesting things. There is a lot more to the IDE, here is a quick
|
||||
breakdown of things to see and explore:</p>
|
||||
|
||||
<ul>
|
||||
<li>All sorts of edit commands such as find and replace can be
|
||||
used in the editor windows. See the <tt>Edit</tt> menu.</li>
|
||||
|
||||
<li>The bottom of the edit window has the scrollbar, but at the
|
||||
left are two navigation devices: a line number box that you can type
|
||||
numbers into to quickly go to a specific place, and a popup menu
|
||||
that lists all classes, functions and methods in your file.</li>
|
||||
|
||||
<li>Above the vertical scrollbar you find another popup menu, this
|
||||
influences how the Run command works. You should try the debugger
|
||||
some time! If you do, and you wonder what the new small column on
|
||||
the left of your script is: you can click in it to make Python stop
|
||||
when it reaches this line so you can inspect things. The profiler
|
||||
is also nifty: it shows you where your program is spending its time.</li>
|
||||
|
||||
<li>The module browser (<tt>Python->Module Browser</tt>) shows you all Python
|
||||
modules currently loaded. You can look at the contents of the module with
|
||||
Browse... and (for modules written in Python) at the source with Source...</li>
|
||||
|
||||
<li>The Package Manager (under the <tt>File</tt> menu, also available as a
|
||||
separate application) allows you to easily install Python extension packages
|
||||
for all sorts of things: scientific computation, image processing,
|
||||
building user interfaces and more. </li>
|
||||
|
||||
<li>The <tt>Help</tt> menu gives you quick access to both the Python documentation,
|
||||
if you have installed it with the Package Manager, and the Apple Developer
|
||||
documentation. </li>
|
||||
|
||||
<li>The <tt>File->Save as Applet</tt> menu command saves your script as a MacOSX
|
||||
application. This allows you to create a script that you can drop files on,
|
||||
and much more. The IDE itself is such an applet, completely written in Python. </li>
|
||||
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
Before Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 12 KiB |
|
@ -1,51 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
|
||||
<title>MacPython Help</title>
|
||||
<meta name="generator" content="BBEdit 6.5.3">
|
||||
<link rel="SHORTCUT ICON" href="pythonsmall.gif">
|
||||
<META NAME="AppleIcon" CONTENT="pythonsmall.gif">
|
||||
<META NAME="AppleTitle" CONTENT="MacPython Help">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>MacPython Help</h1>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="python.gif" width="128" height="128" align="top" alt="">
|
||||
</td>
|
||||
<td>
|
||||
<p>Choose a topic, or enter keywords into the search field:</p>
|
||||
<ul>
|
||||
<li><a href="intro.html">What is MacPython?</a>
|
||||
</li>
|
||||
<li><a href="ide/index.html">MacPython
|
||||
Integrated Development Environment Introduction</a>
|
||||
</li>
|
||||
<li><a href="doc/index.html">Python Language and runtime documentation</a>
|
||||
</li>
|
||||
<li><a href="finder.html">Running Python scripts from the Finder</a>
|
||||
</li>
|
||||
<li><a href="shell.html">Running Python scripts from the Unix Shell</a>
|
||||
</li>
|
||||
<li><a href="gui.html">Creating a User Interface with MacPython</a>
|
||||
</li>
|
||||
<li><a href="scripting.html">Controlling other Applications from MacPython</a>
|
||||
</li>
|
||||
<li><a href="packman.html">Installing additional functionality with the
|
||||
Package Manager</a>
|
||||
</li>
|
||||
<li><a href="community.html">MacPython community</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,76 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
|
||||
<title>What is MacPython?</title>
|
||||
<meta name="generator" content="BBEdit 6.5.3">
|
||||
<link rel="SHORTCUT ICON" href="pythonsmall.gif">
|
||||
<META NAME="AppleIcon" CONTENT="pythonsmall.gif">
|
||||
</head>
|
||||
<body>
|
||||
<h1>What is MacPython?</h1>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="python.gif" width="128" height="128" align="top" alt="">
|
||||
</td>
|
||||
<td>
|
||||
<p>Python is a programming language. MacPython is a package containing
|
||||
that programming language plus Mac-specific tools and extensions.</p>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr>
|
||||
|
||||
<h2>The Python Language</h2>
|
||||
<p>The Python programming language is available for many hardware
|
||||
platforms, and most general documentation is Unix- or Windows-centered. Keep
|
||||
this in mind when reading the rest of this help, or information on the web.
|
||||
</p>
|
||||
|
||||
<p>The Python website, <a href="http://www.python.org">www.python.org</a>,
|
||||
has a <em>Beginners Guide</em> section including an
|
||||
<a href="http://python.org/doc/essays/blurb.html">executive summary</a> on
|
||||
the language and a
|
||||
<a href="http://python.org/doc/essays/comparisons.html">comparison</a> of Python
|
||||
to other languages. Or read the (rather longwinded) Python
|
||||
Tutorial in the <a href="doc/index.html">Python Language and runtime documentation</a>.</p>
|
||||
|
||||
<p>MacPython contains a complete <a href="shell.html">unix interpreter</a> so
|
||||
if you are familiar with Python on unix you should feel right at home.</p>
|
||||
|
||||
<h2>MacPython additions</h2>
|
||||
|
||||
<p>The MacPython Integrated Development Environment (IDE) allows
|
||||
easy editing, running and debugging of scripts. Read the
|
||||
<a href="ide/index.html">Introduction
|
||||
to the IDE</a> to whet your appetite.</p>
|
||||
|
||||
<p>MacPython comes with lots of modules that allow access to
|
||||
MacOS-specific technology, such as Carbon, Quicktime and AppleScript.
|
||||
See the <em>Macintosh
|
||||
Modules</em> section of the
|
||||
<a href="doc/index.html">Python Language and runtime documentation</a>,
|
||||
but please keep in mind that some information there still pertains to
|
||||
Mac OS 9.
|
||||
|
||||
Full access to the Cocoa APIs
|
||||
and tools such as Interface Builder is available separately through the
|
||||
<a href="packman.html">Package Manager</a>.</p>
|
||||
|
||||
<p>The <a href="packman.html">Package Manager</a> also gives you access to extension
|
||||
packages for cross-platform GUI development (Tkinter, wxPython, PyOpenGL),
|
||||
image processing (PIL), scientific
|
||||
computing (Numeric) and much more. <em>PyObjC</em> deserves a special mention: it allows
|
||||
transparent access to Cocoa and Interface Builder, similar to what Java provides,
|
||||
thereby making Python a first class citizen in the Mac OS X developer world. </p>
|
||||
|
||||
<p>Python scripts can be saved as <em>applets</em>, semi-standalone applications
|
||||
that work just like a normal application. Additionally you can even create
|
||||
true standalone application that have everything embedded and can be
|
||||
shipped to anyone, without the need to install Python. You do <em>not</em>
|
||||
need to install the Apple Developer Tools for this. </p>
|
||||
</body>
|
||||
</html>
|
|
@ -1,64 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
|
||||
<title>Python Package Manager</title>
|
||||
<meta name="generator" content="BBEdit 6.5.3">
|
||||
<link rel="SHORTCUT ICON" href="pythonsmall.gif">
|
||||
<META NAME="AppleIcon" CONTENT="pythonsmall.gif">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Installing additional Python Packages</h1>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="PackageManager.gif" width="128" height="128" align="top" alt="">
|
||||
</td>
|
||||
<td>
|
||||
<p>The Python Package Manager helps you installing additional
|
||||
packages that enhance Python. It determines the exact MacOS version
|
||||
and Python version you have and uses that information to download
|
||||
a database that has packages that are test and tried on that
|
||||
combination. In other words: if something is in your Package Manager
|
||||
window but does not work you are free to blame the database maintainer.</p>
|
||||
|
||||
<p>PackageManager then checks which of the packages you have installed
|
||||
and which ones not. This should also work when you have installed packages
|
||||
outside of PackageManager.
|
||||
You can select packages and install them, and PackageManager will work
|
||||
out the requirements and install these too.</p>
|
||||
|
||||
<p>Often PackageManager will list a package in two flavors: binary
|
||||
and source. Binary should always work, source will only work if
|
||||
you have installed the Apple Developer Tools. PackageManager will warn
|
||||
you about this, and also about other external dependencies.</p>
|
||||
|
||||
<p>PackageManager is available as a separate application and also
|
||||
as a function of the IDE, through the <tt>File->Package Manager</tt> menu
|
||||
entry. </p>
|
||||
|
||||
<h2>Troubleshooting</h2>
|
||||
|
||||
<p>If package manager fails to open the database first check that you are
|
||||
connected to the internet. If you are connected then the problem
|
||||
could be that there is no database (yet?) for your version of Mac OS X.
|
||||
You may be able to find an alternative
|
||||
database that works for your system at
|
||||
<a href="http://www.python.org/packman">http://www.python.org/packman</a>.
|
||||
In the standalone Package Manager you can then open such an alternative database
|
||||
with the <tt>File->Open URL...</tt> command, but you should realize that
|
||||
you are now on untested ground.</p>
|
||||
|
||||
<p>Another potential problem source is that you are behind a firewall. This version
|
||||
of PackageManager uses the Unix method of setting a firewall: you need to set the
|
||||
environment variable <tt>http_proxy</tt> to <tt>"http://<i>proxyhost</i>:<i>port</i>"</tt>.
|
||||
See <a href="http://developer.apple.com/qa/qa2001/qa1067.html">Apple Technical
|
||||
Q&A QA1067</a> for instructions.</p>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr>
|
||||
</body>
|
||||
</html>
|
Before Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 138 B |
|
@ -1,53 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
|
||||
<title>Controlling other Applications from MacPython</title>
|
||||
<meta name="generator" content="BBEdit 6.5.3">
|
||||
<link rel="SHORTCUT ICON" href="pythonsmall.gif">
|
||||
<META NAME="AppleIcon" CONTENT="pythonsmall.gif">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Controlling other Applications from MacPython</h1>
|
||||
|
||||
<p>Python has a fairly complete implementation of the Open Scripting
|
||||
Architecure (OSA, also commonly referred to as AppleScript), allowing
|
||||
you to control scriptable applications from your Python program,
|
||||
and with a fairly pythonic interface. This piece of
|
||||
Python:</p>
|
||||
|
||||
<blockquote><pre><tt>
|
||||
import Finder
|
||||
|
||||
f = Finder.Finder()
|
||||
print f.get(f.window(1).name)
|
||||
</tt></pre></blockquote>
|
||||
|
||||
<p>is identical to the following piece of AppleScript:</p>
|
||||
|
||||
<blockquote><pre><tt>
|
||||
tell application "Finder"
|
||||
get name of window 1
|
||||
end tell
|
||||
</tt></pre></blockquote>
|
||||
|
||||
<p>To send AppleEvents to an application you must first create the Python
|
||||
modules interfacing to the terminology of the application (what
|
||||
<tt>Script Editor</tt> calls the "Dictionary"). Use the IDE menu command
|
||||
<tt>File->Generate OSA Suite...</tt> for this. For more control run</p>
|
||||
|
||||
<blockquote><tt>
|
||||
pythonw .../Lib/plat-mac/gensuitemodule.py --help
|
||||
</tt></blockquote>
|
||||
|
||||
<p>from a terminal window.</p>
|
||||
|
||||
<h2>Creating a scriptable application in Python</h2>
|
||||
|
||||
You can also create a scriptable application in Python, but this is not
|
||||
very well documented. For Carbon
|
||||
applications you should look at the <tt>MiniAEFrame</tt> module.
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,52 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
|
||||
<title>Python and the Unix Shell</title>
|
||||
<meta name="generator" content="BBEdit 6.5.3">
|
||||
<link rel="SHORTCUT ICON" href="pythonsmall.gif">
|
||||
<META NAME="AppleIcon" CONTENT="pythonsmall.gif">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Running Python scripts from the Unix Shell</h1>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<img src="python.gif" width="128" height="128" align="top" alt="">
|
||||
</td>
|
||||
<td>
|
||||
<p>MacPython 2.3 installs a perfectly normal Unix commandline
|
||||
python interpreter in <tt>/usr/local/bin/python</tt>. As of Mac OS X 10.2, however,
|
||||
<tt>/usr/local/bin</tt> is not on the search path of your shell. Moreover,
|
||||
Apple's python 2.2, which lives in <tt>/usr/bin</tt> <em>is</em> on your
|
||||
search path, so this can lead to confusion.</p>
|
||||
|
||||
<p>If you use <tt>tcsh</tt> you should add the following line
|
||||
to the file <tt>.login</tt> in your home directory and restart Terminal:
|
||||
<br>
|
||||
<tt>setenv PATH /usr/local/bin:$PATH</tt>
|
||||
</p>
|
||||
|
||||
<p>If you use <tt>bash</tt> or <tt>zsh</tt>
|
||||
you should add the following line
|
||||
to the file <tt>.profile</tt> in your home directory and restart Terminal:
|
||||
<br>
|
||||
<tt>export PATH=/usr/local/bin:$PATH</tt>
|
||||
</p>
|
||||
|
||||
<h2>GUI scripts</h2>
|
||||
|
||||
<p>Due to the way MacOS handles windowing applications you need to run
|
||||
<em>all</em> scripts that use the window manager (be it through
|
||||
Carbon, Cocoa, Tkinter, wxPython, PyOpenGL or anything else) with the
|
||||
<tt>pythonw</tt> interpreter, also installed in <tt>/usr/local/bin</tt>.</p>
|
||||
|
||||
<p>Running with <tt>python</tt> results in an inability to bring the
|
||||
script to the front, or interacting with it. </p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr>
|
||||
</body>
|
||||
</html>
|
|
@ -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 is not 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 is None:
|
||||
build_cmd = self.get_finalized_command('build')
|
||||
self.build_dest = build_cmd.build_dest
|
||||
if self.install_doc is 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()
|