- change_root(new_root, pathname)
- Return 'pathname' with 'new_root' prepended. If 'pathname' is
relative, this is equivalent to "os.path.join(new_root,pathname)".
Otherwise, it requires making 'pathname' relative and then joining the
two, which is tricky on DOS/Windows and Mac OS.
- Ensure that 'os.environ' has all the environment variables we
guarantee that users can use in config files, command-line
options, etc. Currently this includes:
HOME - user's home directory (Unix only)
PLAT - description of the current platform, including hardware
and OS (see 'get_platform()')
- Return 'pathname' as a name that will work on the native
filesystem, i.e. split it on '/' and put it back together again
using the current directory separator. 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 if 'pathname' is
absolute (starts with '/') or contains local directory separators
(unless the local separator is '/', of course).
- execute(func, args, msg=None, verbose=0, dry_run=0)
- Perform some action that affects the outside world (eg. by writing
to the filesystem). Such actions are special because they are disabled
by the 'dry_run' flag, and announce themselves if 'verbose' is true.
This method takes care of all that bureaucracy for you; all you have to
do is supply the function to call and an argument tuple for it (to
embody the "external action" being performed), and an optional message
- Return a string (suitable for tacking onto directory names) that
identifies the current platform. Currently, this is just
- grok_environment_error(exc, prefix='error: ')
- Generate a useful error message from an EnvironmentError (IOError or
OSError) exception object. Handles Python 1.5.1 and 1.5.2 styles, and
does what it can to deal with exception objects that don't have a
filename (which happens when the error is due to a two-file operation,
such as 'rename()' or 'link()'. Returns the error message as a string
prefixed with 'prefix'.
- 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
- subst_vars(str, local_vars)
- Perform shell/Perl-style variable substitution on 'string'.
Every occurrence of '$' followed by a name, or a name enclosed in
braces, is considered a variable. Every variable is substituted by
the value found in the 'local_vars' dictionary, or in 'os.environ'
if it's not in 'local_vars'. 'os.environ' is first checked/
augmented to guarantee that it contains certain values: see
'_check_environ()'. Raise ValueError for any variables not found in
either 'local_vars' or 'os.environ'.