@@ -9,18 +9,29 @@ \section{Standard Module \sectcode{site}}
99\code {import site} somewhere near the top of their code. This is no
1010longer necessary.
1111
12- This will append up site-specific paths to to the module search path.
13- It starts with \code {sys.prefix} and \code {sys.exec_prefix} (if
14- different) and appends \file {lib/python\var {version}/packages}. The
15- resulting directory, if it exists, is added to \code {sys.path}, and
16- also inspected for path configuration files. A path configuration
17- file is a file whose name has the form \file {\var {package}.pth}; its
18- contents are additional directories (one per line) to be added to
19- \code {sys.path}. Non-existing directories (or non-directories) are
20- never added to \code {sys.path}; no directory is added to
12+ This will append site-specific paths to to the module search path.
13+
14+ It starts by constructing up to four directories from a head and a
15+ tail part. For the head part, it uses \code {sys.prefix} and
16+ \code {sys.exec_prefix}; empty heads are skipped. For
17+ the tail part, it uses the empty string (on Mac or Windows) or it uses
18+ first \file {lib/python\var {version}/packages} and then
19+ \file {lib/site-python} (on Unix). For each of the distinct head-tail
20+ combinations, it sees if it refers to an existing directory, and if
21+ so, adds to \code {sys.path}, and also inspected for path configuration
22+ files.
23+ \indexii {site-python}{directory}
24+ \indexii {packages}{directory}
25+
26+ A path configuration file is a file whose name has the form
27+ \file {\var {package}.pth}; its contents are additional items (one
28+ per line) to be added to \code {sys.path}. Non-existing items are
29+ never added to \code {sys.path}, but no check is made that the item
30+ refers to a directory (rather than a file). No item is added to
2131\code {sys.path} more than once. Blank lines and lines beginning with
2232\code {\# } are skipped.
2333\index {package}
34+ \indexiii {path}{configuration}{file}
2435\kwindex {sys.prefix}
2536\kwindex {sys.exec_prefix}
2637\kwindex {prefix}
0 commit comments