From 7706c2da14e5b7a54d9b97d340c42497cc557c9f Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Sun, 13 Feb 2005 22:50:04 +0000 Subject: Update references specifying "Macintosh" to mean OS X semantics and not Mac OS 9. Applies patch #1095802. Thanks Jack Jansen. --- Doc/api/init.tex | 7 +- Doc/api/utilities.tex | 2 +- Doc/dist/dist.tex | 12 +- Doc/ext/extending.tex | 3 +- Doc/inst/inst.tex | 34 ++--- Doc/lib/libimp.tex | 4 +- Doc/lib/libos.tex | 158 ++++++++++----------- Doc/lib/libsite.tex | 4 +- Doc/lib/libtempfile.tex | 1 - Doc/mac/libframework.tex | 3 +- Doc/mac/libmac.tex | 40 +----- Doc/mac/libmacic.tex | 13 +- Doc/mac/libmacos.tex | 92 ++---------- Doc/mac/scripting.tex | 7 +- Doc/mac/undoc.tex | 74 +--------- Doc/mac/using.tex | 356 ++++++++--------------------------------------- Doc/tut/tut.tex | 3 +- 17 files changed, 191 insertions(+), 622 deletions(-) diff --git a/Doc/api/init.tex b/Doc/api/init.tex index e8d3583..96a13d3 100644 --- a/Doc/api/init.tex +++ b/Doc/api/init.tex @@ -239,9 +239,8 @@ program name (set by \cfunction{Py_SetProgramName()} above) and some environment variables. The returned string consists of a series of directory names separated by a platform dependent delimiter - character. The delimiter character is \character{:} on \UNIX, - \character{;} on Windows, and \character{\e n} (the \ASCII{} - newline character) on Macintosh. The returned string points into + character. The delimiter character is \character{:} on \UNIX and Mac OS X, + \character{;} on Windows. The returned string points into static storage; the caller should not modify its value. The value is available to Python code as the list \code{sys.path}\withsubitem{(in module sys)}{\ttindex{path}}, which @@ -272,7 +271,7 @@ this is formed from the ``official'' name of the operating system, converted to lower case, followed by the major revision number; e.g., for Solaris 2.x, which is also known as SunOS 5.x, the value - is \code{'sunos5'}. On Macintosh, it is \code{'mac'}. On Windows, + is \code{'sunos5'}. On Mac OS X, it is \code{'darwin'}. On Windows, it is \code{'win'}. The returned string points into static storage; the caller should not modify its value. The value is available to Python code as \code{sys.platform}. diff --git a/Doc/api/utilities.tex b/Doc/api/utilities.tex index 590df6c..397643e 100644 --- a/Doc/api/utilities.tex +++ b/Doc/api/utilities.tex @@ -34,7 +34,7 @@ values from C values. Return true when the interpreter runs out of stack space. This is a reliable check, but is only available when \constant{USE_STACKCHECK} is defined (currently on Windows using the Microsoft Visual \Cpp{} - compiler and on the Macintosh). \constant{USE_CHECKSTACK} will be + compiler). \constant{USE_CHECKSTACK} will be defined automatically; you should never change the definition in your own code. \end{cfuncdesc} diff --git a/Doc/dist/dist.tex b/Doc/dist/dist.tex index e06b887..a39478a 100644 --- a/Doc/dist/dist.tex +++ b/Doc/dist/dist.tex @@ -298,7 +298,7 @@ platform-neutral representation into whatever is appropriate on your current platform before actually using the pathname. This makes your setup script portable across operating systems, which of course is one of the major goals of the Distutils. In this spirit, all pathnames in -this document are slash-separated. (Mac OS programmers should keep in +this document are slash-separated. (Mac OS 9 programmers should keep in mind that the \emph{absence} of a leading slash indicates a relative path, the opposite of the Mac OS convention with colons.) @@ -1021,7 +1021,6 @@ python setup.py sdist script or config file), \command{sdist} creates the archive of the default format for the current platform. The default format is a gzip'ed tar file (\file{.tar.gz}) on \UNIX, and ZIP file on Windows. -\XXX{no Mac OS support here} You can specify as many formats as you like using the \longprogramopt{formats} option, for example: @@ -2059,9 +2058,9 @@ regular filename character, and \code{[\var{range}]} matches any of the characters in \var{range} (e.g., \code{a-z}, \code{a-zA-Z}, \code{a-f0-9\_.}). The definition of ``regular filename character'' is platform-specific: on \UNIX{} it is anything except slash; on Windows -anything except backslash or colon; on Mac OS anything except colon. +anything except backslash or colon; on Mac OS 9 anything except colon. -\XXX{Windows and Mac OS support not there yet} +\XXX{Windows support not there yet} %\section{Creating a built distribution: the @@ -2759,7 +2758,8 @@ This module provides the EMXCCompiler class, a subclass of \class{UnixCCompiler} \modulesynopsis{Metrowerks CodeWarrior support} Contains \class{MWerksCompiler}, an implementation of the abstract -\class{CCompiler} class for MetroWerks CodeWarrior on the Macintosh. Needs work to support CW on Windows. +\class{CCompiler} class for MetroWerks CodeWarrior on the pre-Mac OS X Macintosh. +Needs work to support CW on Windows or Mac OS X. %\subsection{Utility modules} @@ -2999,7 +2999,7 @@ starts or ends with a slash. Return \var{pathname} with \var{new_root} prepended. If \var{pathname} is relative, this is equivalent to \samp{os.path.join(new_root,pathname)} Otherwise, it requires making \var{pathname} relative and then joining the -two, which is tricky on DOS/Windows and Mac OS. +two, which is tricky on DOS/Windows. \end{funcdesc} \begin{funcdesc}{check_environ}{} diff --git a/Doc/ext/extending.tex b/Doc/ext/extending.tex index 693af1d..bc2f9cb 100644 --- a/Doc/ext/extending.tex +++ b/Doc/ext/extending.tex @@ -374,7 +374,7 @@ called automatically unless there's an entry in the \cdata{_PyImport_Inittab} table. The easiest way to handle this is to statically initialize your statically-linked modules by directly calling \cfunction{initspam()} after the call to -\cfunction{Py_Initialize()} or \cfunction{PyMac_Initialize()}: +\cfunction{Py_Initialize()}: \begin{verbatim} int @@ -426,7 +426,6 @@ system uses; see the chapters about building extension modules (chapter \ref{building}) and additional information that pertains only to building on Windows (chapter \ref{building-on-windows}) for more information about this. -% XXX Add information about Mac OS If you can't use dynamic loading, or if you want to make your module a permanent part of the Python interpreter, you will have to change the diff --git a/Doc/inst/inst.tex b/Doc/inst/inst.tex index a638ab6..3cddba2 100644 --- a/Doc/inst/inst.tex +++ b/Doc/inst/inst.tex @@ -142,7 +142,7 @@ python setup.py install On \UNIX, you'd run this command from a shell prompt; on Windows, you have to open a command prompt window (``DOS box'') and do it there; on -Mac OS, things are a tad more complicated (see below). +Mac OS X, you open a \command{Terminal} window to get a shell prompt. \subsection{Platform variations} @@ -262,7 +262,8 @@ If you don't choose an installation directory---i.e., if you just run \code{setup.py install}---then the \command{install} command installs to the standard location for third-party Python modules. This location varies by platform and by how you built/installed Python itself. On -\UNIX{} and Mac OS, it also depends on whether the module distribution +\UNIX{} (and Mac OS X, which is also Unix-based), +it also depends on whether the module distribution being installed is pure Python or contains extensions (``non-pure''): \begin{tableiv}{l|l|l|c}{textrm}% {Platform}{Standard installation location}{Default value}{Notes} @@ -278,14 +279,6 @@ being installed is pure Python or contains extensions (``non-pure''): {\filenq{\filevar{prefix}}} {\filenq{C:\textbackslash{}Python}} {(2)} - \lineiv{Mac OS (pure)} - {\filenq{\filevar{prefix}:Lib:site-packages}} - {\filenq{Python:Lib:site-packages}} - {} - \lineiv{Mac OS (non-pure)} - {\filenq{\filevar{prefix}:Lib:site-packages}} - {\filenq{Python:Lib:site-packages}} - {} \end{tableiv} \noindent Notes: @@ -302,8 +295,8 @@ being installed is pure Python or contains extensions (``non-pure''): \filevar{prefix} and \filevar{exec-prefix} stand for the directories that Python is installed to, and where it finds its libraries at -run-time. They are always the same under Windows and Mac OS, and very -often the same under \UNIX. You can find out what your Python +run-time. They are always the same under Windows, and very +often the same under \UNIX and Mac OS X. You can find out what your Python installation uses for \filevar{prefix} and \filevar{exec-prefix} by running Python in interactive mode and typing a few simple commands. Under \UNIX, just type \code{python} at the shell prompt. Under @@ -658,7 +651,7 @@ environment variables, such as Mac OS 9, the configuration variables supplied by the Distutils are the only ones you can use.) See section~\ref{config-files} for details. -% XXX need some Windows and Mac OS examples---when would custom +% XXX need some Windows examples---when would custom % installation schemes be needed on those platforms? @@ -764,7 +757,7 @@ apply, values from ``earlier'' files are overridden by ``later'' files. \label{config-filenames} The names and locations of the configuration files vary slightly across -platforms. On \UNIX, the three configuration files (in the order they +platforms. On \UNIX and Mac OS X, the three configuration files (in the order they are processed) are: \begin{tableiii}{l|l|c}{textrm} {Type of file}{Location and filename}{Notes} @@ -773,7 +766,7 @@ are processed) are: \lineiii{local}{\filenq{setup.cfg}}{(3)} \end{tableiii} -On Windows, the configuration files are: +And on Windows, the configuration files are: \begin{tableiii}{l|l|c}{textrm} {Type of file}{Location and filename}{Notes} \lineiii{system}{\filenq{\filevar{prefix}\textbackslash{}Lib\textbackslash{}distutils\textbackslash{}distutils.cfg}}{(4)} @@ -781,14 +774,6 @@ On Windows, the configuration files are: \lineiii{local}{\filenq{setup.cfg}}{(3)} \end{tableiii} -And on Mac OS, they are: -\begin{tableiii}{l|l|c}{textrm} - {Type of file}{Location and filename}{Notes} - \lineiii{system}{\filenq{\filevar{prefix}:Lib:distutils:distutils.cfg}}{(6)} - \lineiii{personal}{N/A}{} - \lineiii{local}{\filenq{setup.cfg}}{(3)} -\end{tableiii} - \noindent Notes: \begin{description} \item[(1)] Strictly speaking, the system-wide configuration file lives @@ -818,9 +803,6 @@ And on Mac OS, they are: defined, no personal configuration file will be found or used. (In other words, the Distutils make no attempt to guess your home directory on Windows.) -\item[(6)] (See also notes (1) and (4).) The default installation - prefix is just \file{Python:}, so under Python 1.6 and later this is - normally\file{Python:Lib:distutils:distutils.cfg}. \end{description} diff --git a/Doc/lib/libimp.tex b/Doc/lib/libimp.tex index ffab5c9..e0a775c 100644 --- a/Doc/lib/libimp.tex +++ b/Doc/lib/libimp.tex @@ -135,8 +135,8 @@ The module was found as dynamically loadable shared library. \end{datadesc} \begin{datadesc}{PY_RESOURCE} -The module was found as a Macintosh resource. This value can only be -returned on a Macintosh. +The module was found as a Mac OS 9 resource. This value can only be +returned on a Mac OS 9 or earlier Macintosh. \end{datadesc} \begin{datadesc}{PKG_DIRECTORY} diff --git a/Doc/lib/libos.tex b/Doc/lib/libos.tex index 669cc8f..bf6e5d6 100644 --- a/Doc/lib/libos.tex +++ b/Doc/lib/libos.tex @@ -337,7 +337,7 @@ the command (encoded in the format specified for \function{wait()}) is available as the return value of the \method{close()} method of the file object, except that when the exit status is zero (termination without errors), \code{None} is returned. -Availability: \UNIX, Windows. +Availability: Macintosh, \UNIX, Windows. \versionchanged[This function worked unreliably under Windows in earlier versions of Python. This was due to the use of the @@ -350,7 +350,7 @@ Availability: \UNIX, Windows. Return a new file object opened in update mode (\samp{w+b}). The file has no directory entries associated with it and will be automatically deleted once there are no file descriptors for the file. -Availability: \UNIX, Windows. +Availability: Macintosh, \UNIX, Windows. \end{funcdesc} @@ -380,21 +380,21 @@ Issues}{popen2-flow-control.html}'' \begin{funcdesc}{popen2}{cmd\optional{, mode\optional{, bufsize}}} Executes \var{cmd} as a sub-process. Returns the file objects \code{(\var{child_stdin}, \var{child_stdout})}. -Availability: \UNIX, Windows. +Availability: Macintosh, \UNIX, Windows. \versionadded{2.0} \end{funcdesc} \begin{funcdesc}{popen3}{cmd\optional{, mode\optional{, bufsize}}} Executes \var{cmd} as a sub-process. Returns the file objects \code{(\var{child_stdin}, \var{child_stdout}, \var{child_stderr})}. -Availability: \UNIX, Windows. +Availability: Macintosh, \UNIX, Windows. \versionadded{2.0} \end{funcdesc} \begin{funcdesc}{popen4}{cmd\optional{, mode\optional{, bufsize}}} Executes \var{cmd} as a sub-process. Returns the file objects \code{(\var{child_stdin}, \var{child_stdout_and_stderr})}. -Availability: \UNIX, Windows. +Availability: Macintosh, \UNIX, Windows. \versionadded{2.0} \end{funcdesc} @@ -434,7 +434,7 @@ Availability: Macintosh, \UNIX, Windows. \begin{funcdesc}{dup2}{fd, fd2} Duplicate file descriptor \var{fd} to \var{fd2}, closing the latter first if necessary. -Availability: \UNIX, Windows. +Availability: Macintosh, \UNIX, Windows. \end{funcdesc} \begin{funcdesc}{fdatasync}{fd} @@ -453,7 +453,7 @@ known to the host operating system are given in the \code{pathconf_names} dictionary. For configuration variables not included in that mapping, passing an integer for \var{name} is also accepted. -Availability: \UNIX. +Availability: Macintosh, \UNIX. If \var{name} is a string and is not known, \exception{ValueError} is raised. If a specific value for \var{name} is not supported by the @@ -464,7 +464,7 @@ error number. \begin{funcdesc}{fstat}{fd} Return status for file descriptor \var{fd}, like \function{stat()}. -Availability: \UNIX, Windows. +Availability: Macintosh, \UNIX, Windows. \end{funcdesc} \begin{funcdesc}{fstatvfs}{fd} @@ -482,19 +482,19 @@ If you're starting with a Python file object \var{f}, first do \code{\var{f}.flush()}, and then do \code{os.fsync(\var{f}.fileno())}, to ensure that all internal buffers associated with \var{f} are written to disk. -Availability: \UNIX, and Windows starting in 2.2.3. +Availability: Macintosh, \UNIX, and Windows starting in 2.2.3. \end{funcdesc} \begin{funcdesc}{ftruncate}{fd, length} Truncate the file corresponding to file descriptor \var{fd}, so that it is at most \var{length} bytes in size. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \end{funcdesc} \begin{funcdesc}{isatty}{fd} Return \code{True} if the file descriptor \var{fd} is open and connected to a tty(-like) device, else \code{False}. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \end{funcdesc} \begin{funcdesc}{lseek}{fd, pos, how} @@ -531,13 +531,13 @@ Open a new pseudo-terminal pair. Return a pair of file descriptors \code{(\var{master}, \var{slave})} for the pty and the tty, respectively. For a (slightly) more portable approach, use the \refmodule{pty}\refstmodindex{pty} module. -Availability: Some flavors of \UNIX. +Availability: Macintosh, Some flavors of \UNIX. \end{funcdesc} \begin{funcdesc}{pipe}{} Create a pipe. Return a pair of file descriptors \code{(\var{r}, \var{w})} usable for reading and writing, respectively. -Availability: \UNIX, Windows. +Availability: Macintosh, \UNIX, Windows. \end{funcdesc} \begin{funcdesc}{read}{fd, n} @@ -560,21 +560,21 @@ built-in function \function{open()} or by \function{popen()} or \begin{funcdesc}{tcgetpgrp}{fd} Return the process group associated with the terminal given by \var{fd} (an open file descriptor as returned by \function{open()}). -Availability: \UNIX. +Availability: Macintosh, \UNIX. \end{funcdesc} \begin{funcdesc}{tcsetpgrp}{fd, pg} Set the process group associated with the terminal given by \var{fd} (an open file descriptor as returned by \function{open()}) to \var{pg}. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \end{funcdesc} \begin{funcdesc}{ttyname}{fd} Return a string which specifies the terminal device associated with file-descriptor \var{fd}. If \var{fd} is not associated with a terminal device, an exception is raised. -Availability: \UNIX. +Availability:Macintosh, \UNIX. \end{funcdesc} \begin{funcdesc}{write}{fd, str} @@ -621,7 +621,7 @@ Availability: Macintosh, \UNIX. \begin{datadesc}{O_BINARY} Option for the \var{flag} argument to the \function{open()} function. This can be bit-wise OR'd together with those listed above. -Availability: Macintosh, Windows. +Availability: Windows. % XXX need to check on the availability of this one. \end{datadesc} @@ -657,7 +657,7 @@ one or more of \constant{R_OK}, \constant{W_OK}, and \constant{X_OK} to test permissions. Return \constant{True} if access is allowed, \constant{False} if not. See the \UNIX{} man page \manpage{access}{2} for more information. -Availability: \UNIX, Windows. +Availability: Macintosh, \UNIX, Windows. \end{funcdesc} \begin{datadesc}{F_OK} @@ -701,13 +701,13 @@ Availability: Macintosh, \UNIX, Windows. \begin{funcdesc}{getcwdu}{} Return a Unicode object representing the current working directory. -Availability: \UNIX, Windows. +Availability: Macintosh, \UNIX, Windows. \versionadded{2.3} \end{funcdesc} \begin{funcdesc}{chroot}{path} Change the root directory of the current process to \var{path}. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \versionadded{2.2} \end{funcdesc} @@ -736,25 +736,25 @@ Change the mode of \var{path} to the numeric \var{mode}. \item \code{S_IWOTH} \item \code{S_IXOTH} \end{itemize} -Availability: \UNIX, Windows. +Availability: Macintosh, \UNIX, Windows. \end{funcdesc} \begin{funcdesc}{chown}{path, uid, gid} Change the owner and group id of \var{path} to the numeric \var{uid} and \var{gid}. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \end{funcdesc} \begin{funcdesc}{lchown}{path, uid, gid} Change the owner and group id of \var{path} to the numeric \var{uid} and gid. This function will not follow symbolic links. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \versionadded{2.3} \end{funcdesc} \begin{funcdesc}{link}{src, dst} Create a hard link pointing to \var{src} named \var{dst}. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \end{funcdesc} \begin{funcdesc}{listdir}{path} @@ -770,14 +770,14 @@ object, the result will be a list of Unicode objects.]{2.3} \begin{funcdesc}{lstat}{path} Like \function{stat()}, but do not follow symbolic links. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \end{funcdesc} \begin{funcdesc}{mkfifo}{path\optional{, mode}} Create a FIFO (a named pipe) named \var{path} with numeric mode \var{mode}. The default \var{mode} is \code{0666} (octal). The current umask value is first masked out from the mode. -Availability: \UNIX. +Availability: Macintosh, \UNIX. FIFOs are pipes that can be accessed like regular files. FIFOs exist until they are deleted (for example with \function{os.unlink()}). @@ -844,7 +844,7 @@ known to the host operating system are given in the \code{pathconf_names} dictionary. For configuration variables not included in that mapping, passing an integer for \var{name} is also accepted. -Availability: \UNIX. +Availability: Macintosh, \UNIX. If \var{name} is a string and is not known, \exception{ValueError} is raised. If a specific value for \var{name} is not supported by the @@ -858,7 +858,7 @@ Dictionary mapping names accepted by \function{pathconf()} and \function{fpathconf()} to the integer values defined for those names by the host operating system. This can be used to determine the set of names known to the system. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \end{datadesc} \begin{funcdesc}{readlink}{path} @@ -866,7 +866,7 @@ Return a string representing the path to which the symbolic link points. The result may be either an absolute or relative pathname; if it is relative, it may be converted to an absolute pathname using \code{os.path.join(os.path.dirname(\var{path}), \var{result})}. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \end{funcdesc} \begin{funcdesc}{remove}{path} @@ -1079,7 +1079,7 @@ behavior of this function depends on the C library implementation; some aspects are underspecified in system documentation. \warning{Use of \function{tempnam()} is vulnerable to symlink attacks; consider using \function{tmpfile()} instead.} -Availability: \UNIX, Windows. +Availability: Macintosh, \UNIX, Windows. \end{funcdesc} \begin{funcdesc}{tmpnam}{} @@ -1238,7 +1238,7 @@ Generate a \constant{SIGABRT} signal to the current process. On process immediately returns an exit code of \code{3}. Be aware that programs which use \function{signal.signal()} to register a handler for \constant{SIGABRT} will behave differently. -Availability: \UNIX, Windows. +Availability: Macintosh, \UNIX, Windows. \end{funcdesc} \begin{funcdesc}{execl}{path, arg0, arg1, \moreargs} @@ -1284,13 +1284,13 @@ environment variables for the new process; the \function{execl()}, \function{execlp()}, \function{execv()}, and \function{execvp()} all cause the new process to inherit the environment of the current process. -Availability: \UNIX, Windows. +Availability: Macintosh, \UNIX, Windows. \end{funcdesc} \begin{funcdesc}{_exit}{n} Exit to the system with status \var{n}, without calling cleanup handlers, flushing stdio buffers, etc. -Availability: \UNIX, Windows. +Availability: Macintosh, \UNIX, Windows. \begin{notice} The standard way to exit is \code{sys.exit(\var{n})}. @@ -1306,76 +1306,76 @@ mail server's external command delivery program. \begin{datadesc}{EX_OK} Exit code that means no error occurred. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \versionadded{2.3} \end{datadesc} \begin{datadesc}{EX_USAGE} Exit code that means the command was used incorrectly, such as when the wrong number of arguments are given. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \versionadded{2.3} \end{datadesc} \begin{datadesc}{EX_DATAERR} Exit code that means the input data was incorrect. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \versionadded{2.3} \end{datadesc} \begin{datadesc}{EX_NOINPUT} Exit code that means an input file did not exist or was not readable. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \versionadded{2.3} \end{datadesc} \begin{datadesc}{EX_NOUSER} Exit code that means a specified user did not exist. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \versionadded{2.3} \end{datadesc} \begin{datadesc}{EX_NOHOST} Exit code that means a specified host did not exist. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \versionadded{2.3} \end{datadesc} \begin{datadesc}{EX_UNAVAILABLE} Exit code that means that a required service is unavailable. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \versionadded{2.3} \end{datadesc} \begin{datadesc}{EX_SOFTWARE} Exit code that means an internal software error was detected. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \versionadded{2.3} \end{datadesc} \begin{datadesc}{EX_OSERR} Exit code that means an operating system error was detected, such as the inability to fork or create a pipe. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \versionadded{2.3} \end{datadesc} \begin{datadesc}{EX_OSFILE} Exit code that means some system file did not exist, could not be opened, or had some other kind of error. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \versionadded{2.3} \end{datadesc} \begin{datadesc}{EX_CANTCREAT} Exit code that means a user specified output file could not be created. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \versionadded{2.3} \end{datadesc} \begin{datadesc}{EX_IOERR} Exit code that means that an error occurred while doing I/O on some file. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \versionadded{2.3} \end{datadesc} @@ -1383,40 +1383,40 @@ Availability: \UNIX. Exit code that means a temporary failure occurred. This indicates something that may not really be an error, such as a network connection that couldn't be made during a retryable operation. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \versionadded{2.3} \end{datadesc} \begin{datadesc}{EX_PROTOCOL} Exit code that means that a protocol exchange was illegal, invalid, or not understood. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \versionadded{2.3} \end{datadesc} \begin{datadesc}{EX_NOPERM} Exit code that means that there were insufficient permissions to perform the operation (but not intended for file system problems). -Availability: \UNIX. +Availability: Macintosh, \UNIX. \versionadded{2.3} \end{datadesc} \begin{datadesc}{EX_CONFIG} Exit code that means that some kind of configuration error occurred. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \versionadded{2.3} \end{datadesc} \begin{datadesc}{EX_NOTFOUND} Exit code that means something like ``an entry was not found''. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \versionadded{2.3} \end{datadesc} \begin{funcdesc}{fork}{} Fork a child process. Return \code{0} in the child, the child's process id in the parent. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \end{funcdesc} \begin{funcdesc}{forkpty}{} @@ -1426,7 +1426,7 @@ where \var{pid} is \code{0} in the child, the new child's process id in the parent, and \var{fd} is the file descriptor of the master end of the pseudo-terminal. For a more portable approach, use the \refmodule{pty} module. -Availability: Some flavors of \UNIX. +Availability: Macintosh, Some flavors of \UNIX. \end{funcdesc} \begin{funcdesc}{kill}{pid, sig} @@ -1435,27 +1435,27 @@ Availability: Some flavors of \UNIX. Kill the process \var{pid} with signal \var{sig}. Constants for the specific signals available on the host platform are defined in the \refmodule{signal} module. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \end{funcdesc} \begin{funcdesc}{killpg}{pgid, sig} \index{process!killing} \index{process!signalling} Kill the process group \var{pgid} with the signal \var{sig}. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \versionadded{2.3} \end{funcdesc} \begin{funcdesc}{nice}{increment} Add \var{increment} to the process's ``niceness''. Return the new niceness. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \end{funcdesc} \begin{funcdesc}{plock}{op} Lock program segments into memory. The value of \var{op} (defined in \code{}) determines which segments are locked. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \end{funcdesc} \begin{funcdescni}{popen}{\unspecified} @@ -1536,7 +1536,7 @@ Possible values for the \var{mode} parameter to the \function{spawn*()} family of functions. If either of these values is given, the \function{spawn*()} functions will return as soon as the new process has been created, with the process ID as the return value. -Availability: \UNIX, Windows. +Availability: Macintosh, \UNIX, Windows. \versionadded{1.6} \end{datadesc} @@ -1547,7 +1547,7 @@ family of functions. If this is given as \var{mode}, the has run to completion and will return the exit code of the process the run is successful, or \code{-\var{signal}} if a signal kills the process. -Availability: \UNIX, Windows. +Availability: Macintosh, \UNIX, Windows. \versionadded{1.6} \end{datadesc} @@ -1601,7 +1601,7 @@ this is always \code{0}; on \program{cmd.exe} systems (Windows NT, 2000 and XP) this is the exit status of the command run; on systems using a non-native shell, consult your shell documentation. -Availability: \UNIX, Windows. +Availability: Macintosh, \UNIX, Windows. \end{funcdesc} \begin{funcdesc}{times}{} @@ -1612,7 +1612,7 @@ user time, children's system time, and elapsed real time since a fixed point in the past, in that order. See the \UNIX{} manual page \manpage{times}{2} or the corresponding Windows Platform API documentation. -Availability: \UNIX, Windows. +Availability: Macintosh, \UNIX, Windows. \end{funcdesc} \begin{funcdesc}{wait}{} @@ -1621,7 +1621,7 @@ its pid and exit status indication: a 16-bit number, whose low byte is the signal number that killed the process, and whose high byte is the exit status (if the signal number is zero); the high bit of the low byte is set if a core file was produced. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \end{funcdesc} \begin{funcdesc}{waitpid}{pid, options} @@ -1659,7 +1659,7 @@ return suitable process handles. \begin{datadesc}{WNOHANG} The option for \function{waitpid()} to avoid hanging if no child process status is available immediately. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \end{datadesc} \begin{datadesc}{WCONTINUED} @@ -1674,7 +1674,7 @@ Availability: Some \UNIX{} systems. This option causes child processes to be reported if they have been stopped but their current state has not been reported since they were stopped. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \versionadded{2.3} \end{datadesc} @@ -1686,7 +1686,7 @@ process. \begin{funcdesc}{WCOREDUMP}{status} Returns \code{True} if a core dump was generated for the process, otherwise it returns \code{False}. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \versionadded{2.3} \end{funcdesc} @@ -1706,30 +1706,30 @@ Availability: \UNIX. \begin{funcdesc}{WIFSIGNALED}{status} Returns \code{True} if the process exited due to a signal, otherwise it returns \code{False}. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \end{funcdesc} \begin{funcdesc}{WIFEXITED}{status} Returns \code{True} if the process exited using the \manpage{exit}{2} system call, otherwise it returns \code{False}. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \end{funcdesc} \begin{funcdesc}{WEXITSTATUS}{status} If \code{WIFEXITED(\var{status})} is true, return the integer parameter to the \manpage{exit}{2} system call. Otherwise, the return value is meaningless. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \end{funcdesc} \begin{funcdesc}{WSTOPSIG}{status} Return the signal which caused the process to stop. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \end{funcdesc} \begin{funcdesc}{WTERMSIG}{status} Return the signal which caused the process to exit. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \end{funcdesc} @@ -1746,7 +1746,7 @@ known to the host operating system are given in the \code{confstr_names} dictionary. For configuration variables not included in that mapping, passing an integer for \var{name} is also accepted. -Availability: \UNIX. +Availability: Macintosh, \UNIX. If the configuration value specified by \var{name} isn't defined, the empty string is returned. @@ -1762,7 +1762,7 @@ error number. Dictionary mapping names accepted by \function{confstr()} to the integer values defined for those names by the host operating system. This can be used to determine the set of names known to the system. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \end{datadesc} \begin{funcdesc}{getloadavg}{} @@ -1780,14 +1780,14 @@ If the configuration value specified by \var{name} isn't defined, parameter for \function{confstr()} apply here as well; the dictionary that provides information on the known names is given by \code{sysconf_names}. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \end{funcdesc} \begin{datadesc}{sysconf_names} Dictionary mapping names accepted by \function{sysconf()} to the integer values defined for those names by the host operating system. This can be used to determine the set of names known to the system. -Availability: \UNIX. +Availability: Macintosh, \UNIX. \end{datadesc} @@ -1801,21 +1801,21 @@ Higher-level operations on pathnames are defined in the \begin{datadesc}{curdir} The constant string used by the operating system to refer to the current directory. -For example: \code{'.'} for \POSIX{} or \code{':'} for the Macintosh. +For example: \code{'.'} for \POSIX{} or \code{':'} for Mac OS 9. Also available via \module{os.path}. \end{datadesc} \begin{datadesc}{pardir} The constant string used by the operating system to refer to the parent directory. -For example: \code{'..'} for \POSIX{} or \code{'::'} for the Macintosh. +For example: \code{'..'} for \POSIX{} or \code{'::'} for Mac OS 9. Also available via \module{os.path}. \end{datadesc} \begin{datadesc}{sep} The character used by the operating system to separate pathname components, -for example, \character{/} for \POSIX{} or \character{:} for the -Macintosh. Note that knowing this is not sufficient to be able to +for example, \character{/} for \POSIX{} or \character{:} for +Mac OS 9. Note that knowing this is not sufficient to be able to parse or concatenate pathnames --- use \function{os.path.split()} and \function{os.path.join()} --- but it is occasionally useful. Also available via \module{os.path}. @@ -1859,8 +1859,8 @@ for example, \code{'\e r\e n'} for Windows. \begin{datadesc}{devnull} The file path of the null device. -For example: \code{'/dev/null'} for \POSIX{} or \code{'Dev:Nul'} for the -Macintosh. +For example: \code{'/dev/null'} for \POSIX{} or \code{'Dev:Nul'} for +Mac OS 9. Also available via \module{os.path}. \versionadded{2.4} \end{datadesc} diff --git a/Doc/lib/libsite.tex b/Doc/lib/libsite.tex index 13a4909..cfc17d1 100644 --- a/Doc/lib/libsite.tex +++ b/Doc/lib/libsite.tex @@ -16,9 +16,9 @@ search path. It starts by constructing up to four directories from a head and a tail part. For the head part, it uses \code{sys.prefix} and \code{sys.exec_prefix}; empty heads are skipped. For -the tail part, it uses the empty string (on Macintosh or Windows) or +the tail part, it uses the empty string (on Windows) or it uses first \file{lib/python\shortversion/site-packages} and then -\file{lib/site-python} (on \UNIX). For each of the distinct +\file{lib/site-python} (on \UNIX and Macintosh). For each of the distinct head-tail combinations, it sees if it refers to an existing directory, and if so, adds it to \code{sys.path} and also inspects the newly added path for configuration files. diff --git a/Doc/lib/libtempfile.tex b/Doc/lib/libtempfile.tex index 33faf04..9da8663 100644 --- a/Doc/lib/libtempfile.tex +++ b/Doc/lib/libtempfile.tex @@ -146,7 +146,6 @@ files in. The list is: \item The directory named by the \envvar{TMP} environment variable. \item A platform-specific location: \begin{itemize} - \item On Macintosh, the \file{Temporary Items} folder. \item On RiscOS, the directory named by the \envvar{Wimp\$ScrapDir} environment variable. \item On Windows, the directories diff --git a/Doc/mac/libframework.tex b/Doc/mac/libframework.tex index dc8f99f..e7c38ef 100644 --- a/Doc/mac/libframework.tex +++ b/Doc/mac/libframework.tex @@ -15,7 +15,8 @@ different levels, i.e. to handle clicks in a single dialog window in a non-standard way it is not necessary to override the complete event handling. -The \module{FrameWork} is still very much work-in-progress, and the +Work on the \module{FrameWork} has pretty much stopped, now that +\module{PyObjC} is available for full Cocoa access from Python, and the documentation describes only the most important functionality, and not in the most logical manner at that. Examine the source or the examples for more details. The following are some comments posted on the diff --git a/Doc/mac/libmac.tex b/Doc/mac/libmac.tex index 160753a..9dece8d 100644 --- a/Doc/mac/libmac.tex +++ b/Doc/mac/libmac.tex @@ -1,36 +1,3 @@ -\section{\module{mac} --- - Implementations for the \module{os} module} - -\declaremodule{builtin}{mac} - \platform{Mac} -\modulesynopsis{Implementations for the \module{os} module.} - - -This module implements the Mac OS 9 operating system dependent functionality -provided by the standard module \module{os}\refstmodindex{os}. It is -best accessed through the \module{os} module. This module is only available in -MacPython-OS9, on MacPython-OSX \module{posix} is used. - -The following functions are available in this module: -\function{chdir()}, -\function{close()}, -\function{dup()}, -\function{fdopen()}, -\function{getcwd()}, -\function{lseek()}, -\function{listdir()}, -\function{mkdir()}, -\function{open()}, -\function{read()}, -\function{rename()}, -\function{rmdir()}, -\function{stat()}, -\function{sync()}, -\function{unlink()}, -\function{write()}, -as well as the exception \exception{error}. Note that the times -returned by \function{stat()} are floating-point values, like all time -values in MacPython-OS9. \section{\module{macpath} --- MacOS path manipulation functions} @@ -41,9 +8,10 @@ values in MacPython-OS9. \modulesynopsis{MacOS path manipulation functions.} -This module is the Macintosh implementation of the \module{os.path} -module. It is most portably accessed as -\module{os.path}\refstmodindex{os.path}. Refer to the +This module is the Mac OS 9 (and earlier) implementation of the \module{os.path} +module. It can be used to manipulate old-style Macintosh pathnames on Mac OS +X (or any other platform). +Refer to the \citetitle[../lib/lib.html]{Python Library Reference} for documentation of \module{os.path}. diff --git a/Doc/mac/libmacic.tex b/Doc/mac/libmacic.tex index ad37c10..6d3a0d7 100644 --- a/Doc/mac/libmacic.tex +++ b/Doc/mac/libmacic.tex @@ -6,13 +6,8 @@ \modulesynopsis{Access to Internet Config.} -This module provides access to Macintosh Internet -Config\index{Internet Config} package, -which stores preferences for Internet programs such as mail address, -default homepage, etc. Also, Internet Config contains an elaborate set -of mappings from Macintosh creator/type codes to foreign filename -extensions plus information on how to transfer files (binary, ascii, -etc.). Since MacOS 9, this module is a control panel named Internet. +This module provides access to various internet-related preferences +set through \program{System Preferences} or the \program{Finder}. There is a low-level companion module \module{icglue}\refbimodindex{icglue} which provides the basic @@ -92,7 +87,7 @@ complete incomplete URLs. \begin{methoddesc}{mapfile}{file} Return the mapping entry for the given \var{file}, which can be passed -as either a filename or an \function{macfs.FSSpec()} result, and which +as either a filename or an \function{FSSpec()} result, and which need not exist. The mapping entry is returned as a tuple \code{(\var{version}, @@ -122,7 +117,7 @@ The mapping entry is returned in the same format as for \var{mapfile}. \begin{methoddesc}{settypecreator}{file} Given an existing \var{file}, specified either as a filename or as an -\function{macfs.FSSpec()} result, set its creator and type correctly based +\function{FSSpec()} result, set its creator and type correctly based on its extension. The finder is told about the change, so the finder icon will be updated quickly. \end{methoddesc} diff --git a/Doc/mac/libmacos.tex b/Doc/mac/libmacos.tex index 7b1c79f..b22b39c 100644 --- a/Doc/mac/libmacos.tex +++ b/Doc/mac/libmacos.tex @@ -14,11 +14,10 @@ Note the capitalization of the module name; this is a historical artifact. \begin{datadesc}{runtimemodel} -Either\code{'carbon'} or \code{'macho'}. This -signifies whether this Python uses the Mac OS X and Mac OS 9 compatible -CarbonLib style or the Mac OS -X-only Mach-O style. In earlier versions of Python the value could -also be \code{'ppc'} for the classic Mac OS 8 runtime model. +Always \code{'macho'}, from Python 2.4 on. +In earlier versions of Python the value could +also be \code{'ppc'} for the classic Mac OS 8 runtime model or +\code{'carbon'} for the Mac OS 9 runtime model. \end{datadesc} \begin{datadesc}{linkmodel} @@ -26,8 +25,9 @@ The way the interpreter has been linked. As extension modules may be incompatible between linking models, packages could use this information to give more decent error messages. The value is one of \code{'static'} for a statically linked Python, \code{'framework'} for Python in a Mac OS X framework, -\code{'shared'} for Python in a standard unix shared library and -\code{'cfm'} for the Mac OS 9-compatible Python. +\code{'shared'} for Python in a standard unix shared library. +Older Pythons could also have the value +\code{'cfm'} for Mac OS 9-compatible Python. \end{datadesc} \begin{excdesc}{Error} @@ -39,84 +39,16 @@ Symbolic names for all known error codes are defined in the standard module \refmodule{macerrors}.\refstmodindex{macerrors} \end{excdesc} -\begin{funcdesc}{SetEventHandler}{handler} -In the inner interpreter loop Python will occasionally check for events, -unless disabled with \function{ScheduleParams()}. With this function you -can pass a Python event-handler function that will be called if an event -is available. The event is passed as parameter and the function should return -non-zero if the event has been fully processed, otherwise event processing -continues (by passing the event to the console window package, for instance). - -Call \function{SetEventHandler()} without a parameter to clear the -event handler. Setting an event handler while one is already set is an -error. - -Availability: MacPython-OS9. -\end{funcdesc} - -\begin{funcdesc}{SchedParams}{\optional{doint\optional{, evtmask\optional{, - besocial\optional{, interval\optional{, - bgyield}}}}}} -Influence the interpreter inner loop event handling. \var{Interval} -specifies how often (in seconds, floating point) the interpreter -should enter the event processing code. When true, \var{doint} causes -interrupt (command-dot) checking to be done. \var{evtmask} tells the -interpreter to do event processing for events in the mask (redraws, -mouseclicks to switch to other applications, etc). The \var{besocial} -flag gives other processes a chance to run. They are granted minimal -runtime when Python is in the foreground and \var{bgyield} seconds per -\var{interval} when Python runs in the background. - -All parameters are optional, and default to the current value. The return -value of this function is a tuple with the old values of these options. -Initial defaults are that all processing is enabled, checking is done every -quarter second and the processor is given up for a quarter second when in the -background. - -The most common use case is to call \code{SchedParams(0, 0)} to completely disable -event handling in the interpreter mainloop. - -Availability: MacPython-OS9. -\end{funcdesc} - -\begin{funcdesc}{HandleEvent}{ev} -Pass the event record \var{ev} back to the Python event loop, or -possibly to the handler for the \code{sys.stdout} window (based on the -compiler used to build Python). This allows Python programs that do -their own event handling to still have some command-period and -window-switching capability. - -If you attempt to call this function from an event handler set through -\function{SetEventHandler()} you will get an exception. - -Availability: MacPython-OS9. -\end{funcdesc} \begin{funcdesc}{GetErrorString}{errno} Return the textual description of MacOS error code \var{errno}. \end{funcdesc} -\begin{funcdesc}{splash}{resid} -This function will put a splash window -on-screen, with the contents of the DLOG resource specified by -\var{resid}. Calling with a zero argument will remove the splash -screen. This function is useful if you want an applet to post a splash screen -early in initialization without first having to load numerous -extension modules. - -Availability: MacPython-OS9. -\end{funcdesc} - \begin{funcdesc}{DebugStr}{message \optional{, object}} -On Mac OS 9, drop to the low-level debugger with message \var{message}. The -optional \var{object} argument is not used, but can easily be -inspected from the debugger. On Mac OS X the string is simply printed -to stderr. - -Note that you should use this function with extreme care: if no -low-level debugger like MacsBug is installed this call will crash your -system. It is intended mainly for developers of Python extension -modules. +On Mac OS X the string is simply printed to stderr (on older +Mac OS systems more elaborate functionality was available), +but it provides a convenient location to attach a breakpoint +in a low-level debugger like \program{gdb}. \end{funcdesc} \begin{funcdesc}{SysBeep}{} @@ -155,6 +87,4 @@ or when the current interpreter is not running from a fullblown application bundle. A script runs from an application bundle either when it has been started with \program{pythonw} instead of \program{python} or when running as an applet. - -On Mac OS 9 the method always returns \code{True}. \end{funcdesc} diff --git a/Doc/mac/scripting.tex b/Doc/mac/scripting.tex index 5ef7612..a6d5df7 100644 --- a/Doc/mac/scripting.tex +++ b/Doc/mac/scripting.tex @@ -1,9 +1,10 @@ \chapter{MacPython OSA Modules \label{scripting}} -Python has a fairly complete implementation of the Open Scripting -Architecture (OSA, also commonly referred to as AppleScript), allowing +This chapter describes the current implementation of the Open Scripting +Architecure (OSA, also commonly referred to as AppleScript) for Python, allowing you to control scriptable applications from your Python program, -and with a fairly pythonic interface. +and with a fairly pythonic interface. Development on this set of modules +has stopped, and a replacement is expected for Python 2.5. For a description of the various components of AppleScript and OSA, and to get an understanding of the architecture and terminology, you should diff --git a/Doc/mac/undoc.tex b/Doc/mac/undoc.tex index cf96593..63a4dbd 100644 --- a/Doc/mac/undoc.tex +++ b/Doc/mac/undoc.tex @@ -21,17 +21,7 @@ touch with \modulesynopsis{Helper module for BuildApplet, BuildApplication and macfreeze.} - -\section{\module{py_resource} --- Resources from Python code} -\declaremodule[pyresource]{standard}{py_resource} - \platform{Mac} -\modulesynopsis{Helper to create \texttt{'PYC~'} resources for compiled - applications.} - -This module is primarily used as a help module for -\program{BuildApplet} and \program{BuildApplication}. It is able to -store compiled Python code as \texttt{'PYC~'} resources in a file. - +\deprecated{2.4} \section{\module{cfmfile} --- Code Fragment Resource module} \declaremodule{standard}{cfmfile} @@ -43,6 +33,7 @@ accompanying ``cfrg'' resources. It can parse them and merge them, and is used by BuildApplication to combine all plugin modules to a single executable. +\deprecated{2.4} \section{\module{icopen} --- Internet Config replacement for \method{open()}} \declaremodule{standard}{icopen} @@ -79,30 +70,6 @@ script is run under MacPython, as a MacPython applet or under OSX Python. A low-level interface to Navigation Services. -\section{\module{mkcwproject} --- Create CodeWarrior projects} -\declaremodule{standard}{mkcwproject} - \platform{Mac} -\modulesynopsis{Create CodeWarrior projects.} - -\refmodindex{distutils} -\module{mkcwproject} creates project files for the Metrowerks CodeWarrior -development environment. It is a helper module for -\module{distutils} but can be used separately for more -control. - - -\section{\module{nsremote} --- Wrapper around Netscape OSA modules} -\declaremodule{standard}{nsremote} - \platform{Mac} -\modulesynopsis{Wrapper around Netscape OSA modules.} - -\module{nsremote} is a wrapper around the Netscape OSA modules that -allows you to easily send your browser to a given URL. A related -module that may be of interest is the \module{webbrowser} module, -documented in the \citetitle[../lib/lib.html]{Python Library -Reference}. - - \section{\module{PixMapWrapper} --- Wrapper for PixMap objects} \declaremodule{standard}{PixMapWrapper} \platform{Mac} @@ -112,43 +79,6 @@ Reference}. allows access to the fields by name. It also has methods to convert to and from \module{PIL} images. - -\section{\module{preferences} --- Application preferences manager} -\declaremodule{standard}{preferences} - \platform{Mac} -\modulesynopsis{Nice application preferences manager with support for - defaults.} - -The \module{preferences} module allows storage of user preferences in -the system-wide preferences folder, with defaults coming from the -application itself and the possibility to override preferences for -specific situations. - - -\section{\module{pythonprefs} --- Preferences manager for Python} -\declaremodule{standard}{pythonprefs} - \platform{Mac} -\modulesynopsis{Specialized preferences manager for the Python - interpreter.} - -This module is a specialization of the \refmodule{preferences} module -that allows reading and writing of the preferences for the Python -interpreter. - - -\section{\module{quietconsole} --- Non-visible standard output} -\declaremodule{standard}{quietconsole} - \platform{Mac} -\modulesynopsis{Buffered, non-visible standard output.} - -\module{quietconsole} allows you to keep stdio output in a buffer -without displaying it (or without displaying the stdout window -altogether, if set with \program{EditPythonPrefs}) until you try to read from -stdin or disable the buffering, at which point all the saved output is -sent to the window. Good for programs with graphical user interfaces -that do want to display their output at a crash. - - \section{\module{videoreader} --- Read QuickTime movies} \declaremodule{standard}{videoreader} \platform{Mac} diff --git a/Doc/mac/using.tex b/Doc/mac/using.tex index 79547c1..bfa478e 100644 --- a/Doc/mac/using.tex +++ b/Doc/mac/using.tex @@ -1,27 +1,25 @@ -\chapter{Using Python on a Mac OS 9 Macintosh \label{using}} +\chapter{Using Python on a Macintosh \label{using}} \sectionauthor{Bob Savage}{bobsavage@mac.com} -Using Python on a Macintosh, especially on Mac OS 9 (MacPython-OSX -includes a complete \UNIX{} Python) can seem like something completely -different than using it on a \UNIX-like or Windows system. Most of the -Python documentation, both the ``official'' documentation and published -books, describe only how Python is used on these systems, causing -confusion for the new user of MacPython-OS9. This chapter gives a brief -introduction to the specifics of using Python on a Macintosh. +Python on a Macintosh running Mac OS X is in principle very similar to +Python on any other \UNIX platform, but there are a number of additional +features such as the IDE and the Package Manager that are worth pointing out. +Python on Mac OS 9 or earlier can be quite different from Python on +Unix or Windows, but is beyond the scope of this manual, as that platform +is no longer supported, starting with Python 2.4. See +\url{http://www.cwi.nl/\textasciitilde jack/macpython} for installers +for the latest 2.3 release for Mac OS 9 and related documentation. -The section on the IDE (see Section \ref{IDE}) is relevant to MacPython-OSX -too. +\section{Getting and Installing MacPython \label{getting-OSX}} -\section{Getting and Installing MacPython-OSX \label{getting-OSX}} - -As of Python 2.3a2 the only sure way of getting MacPython-OSX on your machine -is getting a source distribution and building what is called a "framework Python". -The details are in the file \file{Mac/OSX/README}. - -As binary installers become available the details will be posted to -\url{http://www.cwi.nl/\textasciitilde jack/macpython.html}. +Mac OS X 10.3 comes with Python 2.3 pre-installed by Apple. +This installation does not come with the IDE and other additions, however, +so to get these you need to install the \program{MacPython for Panther additions} +from the MacPython website, \url{http://www.cwi.nl/\textasciitilde jack/macpython}. +For MacPython 2.4, or for any MacPython on earlier releases of Mac OS X, +you need to install a full distribution from the same website. What you get after installing is a number of things: @@ -41,6 +39,14 @@ What you get after installing is a number of things: To uninstall MacPython you can simply remove these three things. +If you use the ``additions'' installer to install on top of an existing +Apple-Python you will not get the framework and the commandline interpreter, +as they have been installed by Apple already, in +\file{/System/Library/Frameworks/Python.framework} and +\file{/usr/bin/python}, respectively. You should in principle never modify +or delete these, as they are Apple-controlled and may be used by Apple- or +third-party software. + PythonIDE contains an Apple Help Viewer book called "MacPython Help" which you can access through its help menu. If you are completely new to Python you should start reading the IDE introduction in that document. @@ -57,18 +63,15 @@ menu when the IDE is running. If you want to run Python scripts from the Terminal window command line or from the Finder you first need an editor to create your script. Mac OS X comes with a number of standard \UNIX{} command line editors, -\program{vi} and \program{emacs} among them. If you want a more Mac-like +\program{vim} and \program{emacs} among them. If you want a more Mac-like editor \program{BBEdit} or \program{TextWrangler} from Bare Bones Software (see \url{http://www.barebones.com/products/bbedit/index.shtml}) are -good choices. Their freeware \program{BBEdit Lite} is officially -discontinued but still available. \program{AppleWorks} or any other +good choices. \program{AppleWorks} or any other word processor that can save files in ASCII is also a possibility, including \program{TextEdit} which is included with OS X. To run your script from the Terminal window you must make sure that -\file{/usr/local/bin} is in your shell search path before \file{/usr/bin}, -where the Apple-supplied Python lives (which is version 2.2, as of Mac OS X -10.2.4). +\file{/usr/local/bin} is in your shell search path. To run your script from the Finder you have two options: \begin{itemize} @@ -101,263 +104,6 @@ See Apple's Technical Document QA1067 for details. Installing additional Python packages is most easily done through the Package Manager, see the MacPython Help Book for details. -\section{Getting and Installing MacPython-OS9 \label{getting}} - -The most recent release version as well as possible newer experimental -versions are best found at the MacPython page maintained by Jack -Jansen: \url{http://homepages.cwi.nl/\textasciitilde jack/macpython.html}. - -Please refer to the \file{README} included with your distribution for -the most up-to-date instructions. - -Note that MacPython-OS9 runs fine on Mac OS X, and it runs in native -mode, not in the Classic environment. Unless you have specific -requirements for a CFM-based Python there is no reason not to -use MacPython-OSX, though. - - -\subsection{Entering the interactive Interpreter - \label{interpreter}} - -The interactive interpreter that you will see used in Python -documentation is started by double-clicking the -\program{PythonInterpreter} icon, which looks like a 16-ton weight -falling. You should see the version information and the -\samp{>\code{>}>~} prompt. Use it exactly as described in the -standard documentation. - - -\subsection{How to run a Python script} - -There are several ways to run an existing Python script; two common -ways to run a Python script are ``drag and drop'' and ``double -clicking''. Other ways include running it from within the IDE (see -Section \ref{IDE}), or launching via AppleScript. - - -\subsubsection{Drag and drop} - -One of the easiest ways to launch a Python script is via ``Drag and -Drop''. This is just like launching a text file in the Finder by -``dragging'' it over your word processor's icon and ``dropping'' it -there. Make sure that you use an icon referring to the -\program{PythonInterpreter}, not the \program{IDE} or \program{Idle} -icons which have different behaviour which is described below. - -Some things that might have gone wrong: - -\begin{itemize} -\item -A window flashes after dropping the script onto the -\program{PythonInterpreter}, but then disappears. Most likely this is a -configuration issue; your \program{PythonInterpreter} is setup to exit -immediately upon completion, but your script assumes that if it prints -something that text will stick around for a while. To fix this, see -section \ref{defaults}. - -\item -When you waved the script icon over the \program{PythonInterpreter}, -the \program{PythonInterpreter} icon did not highlight. Most likely -the Creator code and document type is unset (or set incorrectly) -- -this often happens when a file originates on a non-Mac computer. See -section \ref{creator-code} for more details. -\end{itemize} - - -\subsubsection{Set Creator and Double Click \label{creator-code}} - -If the script that you want to launch has the appropriate Creator Code -and File Type you can simply double-click on the script to launch it. -To be ``double-clickable'' a file needs to be of type \samp{TEXT}, -with a creator code of \samp{Pyth}. - -Setting the creator code and filetype can be done with the IDE (see -sections \ref{IDEwrite} and \ref{IDEapplet}), with an editor with a -Python mode (\program{BBEdit}) -- see section -\ref{scripting-with-BBedit}, or with assorted other Mac utilities, but -a script (\file{fixfiletypes.py}) has been included in the MacPython -distribution, making it possible to set the proper Type and Creator -Codes with Python. - -The \file{fixfiletypes.py} script will change the file type and -creator codes for the indicated directory. To use -\file{fixfiletypes.py}: - -\begin{enumerate} -\item -Locate it in the \file{scripts} folder of the \file{Mac} folder of the -MacPython distribution. - -\item -Put all of the scripts that you want to fix in a folder with nothing -else in it. - -\item -Double-click on the \file{fixfiletypes.py} icon. - -\item -Navigate into the folder of files you want to fix, and press the -``Select current folder'' button. -\end{enumerate} - - -\subsection{Simulating command line arguments - \label{argv}} - -There are two ways to simulate command-line arguments with MacPython-OS9. - -\begin{enumerate} -\item via Interpreter options -\begin{itemize} % nestable? I hope so! - \item Hold the option-key down when launching your script. This will - bring up a dialog box of Python Interpreter options. - \item Click ``Set \UNIX-style command line..'' button. - \item Type the arguments into the ``Argument'' field. - \item Click ``OK'' - \item Click ``Run''. -\end{itemize} % end - -\item via drag and drop -If you save the script as an applet (see Section \ref{IDEapplet}), you -can also simulate some command-line arguments via -``Drag-and-Drop''. In this case, the names of the files that were -dropped onto the applet will be appended to \code{sys.argv}, so that -it will appear to the script as though they had been typed on a -command line. As on \UNIX\ systems, the first item in \code{sys.srgv} is -the path to the applet, and the rest are the files dropped on the -applet. -\end{enumerate} - - -\subsection{Creating a Python script} - -Since Python scripts are simply text files, they can be created in any -way that text files can be created, but some special tools also exist -with extra features. - - -\subsubsection{In an editor} - -You can create a text file with any word processing program such as -\program{MSWord} or \program{AppleWorks} but you need to make sure -that the file is saved as ``\ASCII'' or ``plain text''. This also -works for \program{TextEdit}, but you need to use the command ``Make Plain Text`` -in the ``Format`` menu before trying to save. - - -\subsubsection{Editors with Python modes} - -Several text editors have additional features that add functionality -when you are creating a Python script. These can include coloring -Python keywords to make your code easier to read, module browsing, or -a built-in debugger. These include \program{Alpha}, \program{Pepper}, -and \program{BBedit}, and the MacPython IDE (Section \ref{IDE}). - -%\subsubsection{Alpha} -% **NEED INFO HERE** - -\subsubsection{BBedit \label{scripting-with-BBedit}} - -If you use \program{BBEdit} to create your scripts you will want to tell it about the Python creator code so that -you can simply double click on the saved file to launch it. -\begin{itemize} - \item Launch \program{BBEdit}. - \item Select ``Preferences'' from the ``Edit'' menu. - \item Select ``File Types'' from the scrolling list. - \item click on the ``Add...'' button and navigate to - \program{PythonInterpreter} in the main directory of the - MacPython distribution; click ``open''. - \item Click on the ``Save'' button in the Preferences panel. -\end{itemize} -% Are there additional BBedit Python-specific features? I'm not aware of any. - -%\subsubsection{IDE} -%You can use the \program{Python IDE} supplied in the MacPython Distribution to create longer Python scripts -%-- see Section \ref{IDEwrite} for details. - -%\subsubsection{IDLE} -%Idle is an IDE for Python that was written in Python, using TKInter. You should be able to use it on a Mac by following -%the standard documentation, but see Section \ref{TKInter} for guidance on using TKInter with MacPython. - -%\subsubsection{Pepper} -% **NEED INFO HERE** - -\subsection{Configuration \label{configuration}} - -The MacPython distribution comes with \program{EditPythonPrefs}, an -applet which will help you to customize the MacPython environment for -your working habits. - -\subsubsection{EditPythonPrefs\label{EditPythonPrefs}} - -\program{EditPythonPrefs} gives you the capability to configure Python -to behave the way you want it to. There are two ways to use -\program{EditPythonPrefs}, you can use it to set the preferences in -general, or you can drop a particular Python engine onto it to -customize only that version. The latter can be handy if, for example, -you want to have a second copy of the \program{PythonInterpreter} that -keeps the output window open on a normal exit even though you prefer -to normally not work that way. - -To change the default preferences, simply double-click on -\program{EditPythonPrefs}. To change the preferences only for one copy -of the Interpreter, drop the icon for that copy onto -\program{EditPythonPrefs}. You can also use \program{EditPythonPrefs} -in this fashion to set the preferences of the \program{Python IDE} and -any applets you create -- see section %s \ref{BuildApplet} and -\ref{IDEapplet}. - -\subsubsection{Adding modules to the Module Search Path - \label{search-path}} - -When executing an \keyword{import} statement, Python looks for modules -in places defined by the \member{sys.path} To edit the -\member{sys.path} on a Mac, launch \program{EditPythonPrefs}, and -enter them into the largish field at the top (one per line). - -Since MacPython defines a main Python directory, the easiest thing is -to add folders to search within the main Python directory. To add a -folder of scripts that you created called ``My Folder'' located in the -main Python Folder, enter \samp{\$(PYTHON):My Folder} onto a new line. - -To add the Desktop under OS 9 or below, add -\samp{StartupDriveName:Desktop Folder} on a new line. - -\subsubsection{Default startup options \label{defaults}} - -% I'm assuming that there exists some other documentation on the -% rest of the options so I only go over a couple here. - -The ``Default startup options...'' button in the -\program{EditPythonPrefs} dialog box gives you many options including -the ability to keep the ``Output'' window open after the script -terminates, and the ability to enter interactive mode after the -termination of the run script. The latter can be very helpful if you -want to examine the objects that were created during your script. - -%\section{Nifty Tools} -%There are many other tools included with the MacPython -%distribution. In addition to those discussed here, make -%sure to check the \file{Mac} directory. - -%\subsection{BuildApplet \label{BuildApplet}} -% **NEED INFO HERE** - -%\subsection{BuildApplication} -% **NEED INFO HERE** - -%\section{TKInter on the Mac \label{TKInter}} - -%TKinter is installed by default with the MacPython distribution, but -%you may need to add the \file{lib-tk} folder to the Python Path (see -%section \ref{search-path}). Also, it is important that you do not -%try to launch Tk from within the \program{Python IDE} because the two -%event loops will collide -- always run a script which uses Tkinter -%with the \program{PythonInterpreter} instead -- see section -%\ref{interpreter}. - -%\section{CGI on the Mac with Python \label{CGI}} -%**NEED INFO HERE** \section{The IDE\label{IDE}} @@ -365,15 +111,13 @@ The \program{Python IDE} (Integrated Development Environment) is a separate application that acts as a text editor for your Python code, a class browser, a graphical debugger, and more. +The online Python Help contains a quick walkthrough of the IDE that +shows the major features and how to use them. \subsection{Using the ``Python Interactive'' window} -Use this window like you would the \program{PythonInterpreter}, except -that you cannot use the ``Drag and drop'' method above. Instead, -dropping a script onto the \program{Python IDE} icon will open the -file in a separate script window (which you can then execute manually --- see section \ref{IDEexecution}). - +Use this window like you would use a normal \UNIX{} command line +interpreter. \subsection{Writing a Python Script \label{IDEwrite}} @@ -386,11 +130,6 @@ your currently open script by selecting the appropriate item in the ``File'' menu. Dropping a Python script onto the \program{Python IDE} will open it for editing. -If you try to open a script with the \program{Python IDE} but either -can't locate it from the ``Open'' dialog box, or you get an error -message like ``Can't open file of type ...'' see section -\ref{creator-code}. - When the \program{Python IDE} saves a script, it uses the creator code settings which are available by clicking on the small black triangle on the top right of the document window, and selecting ``save @@ -398,8 +137,8 @@ options''. The default is to save the file with the \program{Python IDE} as the creator, this means that you can open the file for editing by simply double-clicking on its icon. You might want to change this behaviour so that it will be opened by the -\program{PythonInterpreter}, and run. To do this simply choose -``Python Interpreter'' from the ``save options''. Note that these +\program{PythonLauncher}, and run. To do this simply choose +``PythonLauncher'' from the ``save options''. Note that these options are associated with the \emph{file} not the application. @@ -449,4 +188,31 @@ system without a Python installation. %\subsection{The ``Scripts'' menu} % **NEED INFO HERE** - + +\section{The Package Manager} + +Historically MacPython came with a number of useful extension packages +included, because most Macintosh users do not have access to a development +environment and C compiler. For Mac OS X that bundling is no longer done, +but a new mechanism has been made available to allow easy access to +extension packages. + +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 tested 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. + +PackageManager then checks which of the packages you have installed and +which ones are 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. + +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. + +PackageManager is available as a separate application and also as a +function of the IDE, through the File->Package Manager menu entry. diff --git a/Doc/tut/tut.tex b/Doc/tut/tut.tex index 6cf0b2b..c48f249 100644 --- a/Doc/tut/tut.tex +++ b/Doc/tut/tut.tex @@ -3105,8 +3105,7 @@ in text files are automatically altered slightly when data is read or written. This behind-the-scenes modification to file data is fine for \ASCII{} text files, but it'll corrupt binary data like that in JPEGs or \file{.EXE} files. Be very careful to use binary mode when reading and -writing such files. (Note that the precise semantics of text mode on -the Macintosh depends on the underlying C library being used.) +writing such files. \subsection{Methods of File Objects \label{fileMethods}} -- cgit v0.12