Give in to Mike Meyer -- add *both* lib/python1.5/packages and

lib/site-python to the path (if they exist).  This is a reasonable
compromise.
This commit is contained in:
Guido van Rossum 1997-09-03 22:05:54 +00:00
parent ad87d3e826
commit f01dff7e93
2 changed files with 40 additions and 18 deletions

View File

@ -9,18 +9,29 @@ modules that needed to use site-specific modules would place
\code{import site} somewhere near the top of their code. This is no \code{import site} somewhere near the top of their code. This is no
longer necessary. longer necessary.
This will append up site-specific paths to to the module search path. This will append site-specific paths to to the module search path.
It starts with \code{sys.prefix} and \code{sys.exec_prefix} (if
different) and appends \file{lib/python\var{version}/packages}. The It starts by constructing up to four directories from a head and a
resulting directory, if it exists, is added to \code{sys.path}, and tail part. For the head part, it uses \code{sys.prefix} and
also inspected for path configuration files. A path configuration \code{sys.exec_prefix}; empty heads are skipped. For
file is a file whose name has the form \file{\var{package}.pth}; its the tail part, it uses the empty string (on Mac or Windows) or it uses
contents are additional directories (one per line) to be added to first \file{lib/python\var{version}/packages} and then
\code{sys.path}. Non-existing directories (or non-directories) are \file{lib/site-python} (on Unix). For each of the distinct head-tail
never added to \code{sys.path}; no directory is added to combinations, it sees if it refers to an existing directory, and if
so, adds to \code{sys.path}, and also inspected for path configuration
files.
\indexii{site-python}{directory}
\indexii{packages}{directory}
A path configuration file is a file whose name has the form
\file{\var{package}.pth}; its contents are additional items (one
per line) to be added to \code{sys.path}. Non-existing items are
never added to \code{sys.path}, but no check is made that the item
refers to a directory (rather than a file). No item is added to
\code{sys.path} more than once. Blank lines and lines beginning with \code{sys.path} more than once. Blank lines and lines beginning with
\code{\#} are skipped. \code{\#} are skipped.
\index{package} \index{package}
\indexiii{path}{configuration}{file}
\kwindex{sys.prefix} \kwindex{sys.prefix}
\kwindex{sys.exec_prefix} \kwindex{sys.exec_prefix}
\kwindex{prefix} \kwindex{prefix}

View File

@ -9,18 +9,29 @@ modules that needed to use site-specific modules would place
\code{import site} somewhere near the top of their code. This is no \code{import site} somewhere near the top of their code. This is no
longer necessary. longer necessary.
This will append up site-specific paths to to the module search path. This will append site-specific paths to to the module search path.
It starts with \code{sys.prefix} and \code{sys.exec_prefix} (if
different) and appends \file{lib/python\var{version}/packages}. The It starts by constructing up to four directories from a head and a
resulting directory, if it exists, is added to \code{sys.path}, and tail part. For the head part, it uses \code{sys.prefix} and
also inspected for path configuration files. A path configuration \code{sys.exec_prefix}; empty heads are skipped. For
file is a file whose name has the form \file{\var{package}.pth}; its the tail part, it uses the empty string (on Mac or Windows) or it uses
contents are additional directories (one per line) to be added to first \file{lib/python\var{version}/packages} and then
\code{sys.path}. Non-existing directories (or non-directories) are \file{lib/site-python} (on Unix). For each of the distinct head-tail
never added to \code{sys.path}; no directory is added to combinations, it sees if it refers to an existing directory, and if
so, adds to \code{sys.path}, and also inspected for path configuration
files.
\indexii{site-python}{directory}
\indexii{packages}{directory}
A path configuration file is a file whose name has the form
\file{\var{package}.pth}; its contents are additional items (one
per line) to be added to \code{sys.path}. Non-existing items are
never added to \code{sys.path}, but no check is made that the item
refers to a directory (rather than a file). No item is added to
\code{sys.path} more than once. Blank lines and lines beginning with \code{sys.path} more than once. Blank lines and lines beginning with
\code{\#} are skipped. \code{\#} are skipped.
\index{package} \index{package}
\indexiii{path}{configuration}{file}
\kwindex{sys.prefix} \kwindex{sys.prefix}
\kwindex{sys.exec_prefix} \kwindex{sys.exec_prefix}
\kwindex{prefix} \kwindex{prefix}