If neither tool is available, raises DistutilsExecError. Returns the name of the output zip file. This module provides functions for performing simple, timestamp-based dependency of files and groups of files; also, functions based entirely on such timestamp dependency analysis. Return false if both exist and target is the same age or newer than source. Raise DistutilsFileError if source does not exist.
Walk two filename lists in parallel, testing if each source is newer than its corresponding target. Return a pair of lists sources , targets where source is newer than target, according to the semantics of newer. Return true if target is out-of-date with respect to any file listed in sources. In other words, if target exists and is newer than every file in sources , return false; otherwise return true.
Create a directory and any missing ancestor directories. If the directory already exists or if name is the empty string, which means the current directory, which of course exists , then do nothing.
Raise DistutilsFileError if unable to create some directory along the way eg. If verbose is true, print a one-line summary of each mkdir to stdout. Return the list of directories actually created. Copy an entire directory tree src to a new location dst. Both src and dst must be directory names. If src is not a directory, raise DistutilsFileError. If dst does not exist, it is created with mkpath.
The end result of the copy is that every file in src is copied to dst , and directories under src are recursively copied to dst. Return the list of files that were copied or might have been copied, using their output name. Files in src that begin with. Recursively remove directory and all files and directories underneath it. Any errors are ignored apart from being reported to sys. Copy file src to dst. If dst is a directory, then src is copied there with the same name; otherwise, it must be a filename.
If the file exists, it will be ruthlessly clobbered. If update is true, src will only be copied if dst does not exist, or if dst does exist but is older than src. Move file src to dst. If dst is a directory, the file will be moved into it with the same name; otherwise, src is just renamed to dst.
Returns the new full name of the file. What about other systems? Create a file called filename and write contents a sequence of strings without line terminators to it. Return a string that identifies the current platform. This is used mainly to distinguish platform-specific build directories and platform-specific built distributions. For universal binary builds on macOS the architecture value reflects the universal binary status instead of the architecture of the current processor.
For bit universal binaries the architecture is fat , for bit universal binaries the architecture is fat64 , and for 4-way universal binaries the architecture is universal.
Starting from Python 2. For AIX, Python 3. Python 3. Needed because filenames in the setup script are always supplied in Unix style, and have to be converted to the local convention before we can actually use them in the filesystem. Raises ValueError on non-Unix-ish systems if pathname either starts or ends with a slash.
If pathname is relative, this is equivalent to os. Currently this includes:. Note that this is not a fully-fledged string interpolation function. Split a string up according to Unix shell-like rules for quotes and backslashes.
In short: words are delimited by spaces, as long as those spaces are not escaped by a backslash, or inside a quoted string. Single and double quotes are equivalent, and the quote characters can be backslash-escaped. The backslash is stripped from any two-character escape sequence, leaving only the escaped character.
The quote characters are stripped from any quoted string. Returns a list of words. Perform some action that affects the outside world for instance, writing to the filesystem. True values are y , yes , t , true , on and 1 ; false values are n , no , f , false , off and 0. Raises ValueError if val is anything else. Byte-compile a collection of Python source files to.
Return a version of header escaped for inclusion in an RFC header, by ensuring there are 8 spaces space after each newline. Note that it does no other modification of the string. Provides exceptions used by the Distutils modules. This module is safe to use in from This module provides a wrapper around the standard getopt module that provides the following additional features:.
Wrapper function. Will use sys. All option tuples must have long options. The FancyGetopt class provides the following methods:. If args is None or not supplied, uses sys. If object is None or not supplied, creates a new OptionDummy instance, stores option values there, and returns a tuple args, object.
If object is supplied, it is modified in place and getopt just returns args ; in both cases, the returned args is a modified copy of the passed-in args list, which is left untouched. Generate help text a list of strings, one per suggested line of output from the option table for this FancyGetopt object.
This module provides the FileList class, used for poking about the filesystem and building lists of files. This module provides the spawn function, a front-end to various platform-specific functions for launching another program in a sub-process.
Deprecated since version 3. The specific configuration variables available depend heavily on the platform and configuration. The specific variables depend on the build process for the specific version of Python being run; the variables are those found in the Makefile and configuration header that are installed with Python on Unix systems. The configuration header is called pyconfig. Some additional functions are provided which perform some useful manipulations for other parts of the distutils package.
The result of os. Return the value of a single variable. Return a set of variable definitions. If there are no arguments, this returns a dictionary mapping names of configuration variables to values. If arguments are provided, they should be strings, and the return value will be a sequence giving the associated values. If a given name does not have a corresponding value, None will be included for that variable. Return the full path name of the configuration header.
For Unix, this will be the header generated by the configure script; for other platforms the header will have been supplied directly by the Python source distribution. The file is a platform-specific text file. Return the full path name of the Makefile used to build Python. For Unix, this will be a file generated by the configure script; the meaning for other platforms will vary. The file is a platform-specific text file, if it exists.
The following functions are deprecated together with this module and they have no direct replacement. Return the directory for either the general or platform-dependent C include files.
Return the directory for either the general or platform-dependent library installation. The following function is only intended for use within the distutils package. Do any platform-specific customization of a distutils. CCompiler instance. This function is only needed on Unix at this time, but should be called consistently to support forward-compatibility.
This information includes the selected compiler, compiler and linker options, and the extension used by the linker for shared objects. Nevertheless, just to be sure that everyone is operating from a common starting point, we offer the following glossary of common Python terms:. Three types of modules concern us here: pure Python modules, extension modules, and packages. Typically contained in a single dynamically loadable pre-compiled file, e.
But we have to call it something. Unlike regular packages, modules in the root package can be found in many directories: in fact, every directory listed in sys. The following terms apply more specifically to the domain of distributing Python modules using the Distutils:. This would be called a package , except that term is already taken in the Python context: a single module distribution may contain zero, one, or many Python packages.
Generally setup. Navigation index modules next previous Python ». Nevertheless, just to be sure that everyone is operating from a common starting point, we offer the following glossary of common Python terms: module the basic unit of code reusability in Python: a block of code imported by some other code.
Table of Contents 1. Consider the simplest possible python setup. Return values seem to be ignored; the documentation says only: All terminal output and filesystem interaction should be done by run.
Perhaps we should infer to exit : class Foo Command Improve this question. Raise an exception? BTW exit should not be used programatically, sys. See stackoverflow. I considered raising an exception, but as noted in my OP, the traceback might not be I would go so far as "probably isn't" desired.
It is an oddball, it is not obvious and you are certainly not the only person using it. Especially considering that each option works under each circumstance anyway! Add a comment. Active Oldest Votes. Improve this answer. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password.
0コメント