summaryrefslogtreecommitdiffstats
path: root/Doc/libsite.tex
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-04-03 22:41:49 (GMT)
committerGuido van Rossum <guido@python.org>1997-04-03 22:41:49 (GMT)
commit571391b963058d5071a5372a4e55cb20c5476622 (patch)
tree263330f7ec90621008ae3a6426e284d1dd73805b /Doc/libsite.tex
parent6191551ad6b122d49878843cb2aab8070f10c180 (diff)
downloadcpython-571391b963058d5071a5372a4e55cb20c5476622.zip
cpython-571391b963058d5071a5372a4e55cb20c5476622.tar.gz
cpython-571391b963058d5071a5372a4e55cb20c5476622.tar.bz2
New stuff by AMK.
Diffstat (limited to 'Doc/libsite.tex')
-rw-r--r--Doc/libsite.tex29
1 files changed, 29 insertions, 0 deletions
diff --git a/Doc/libsite.tex b/Doc/libsite.tex
new file mode 100644
index 0000000..c97fd4e
--- /dev/null
+++ b/Doc/libsite.tex
@@ -0,0 +1,29 @@
+\section{Standard Module \sectcode{site}}
+\stmodindex{site}
+
+Scripts or modules that need to use site-specific modules should
+execute \code{import site} somewhere near the top of their code. This
+will append up to two site-specific paths (\code{sys.prefix +
+'/lib/site-python'} and
+\code{sys.exec_prefix + '/lib/site-python'}) to the module search path.
+\code{sys.prefix} and \code{sys.exec_prefix} are configured when Python is installed; the default value is \file{/usr/local}.
+
+Because of Python's import semantics, it is okay for more than one
+module to import \code{site} -- only the first one will execute the
+site customizations. The directories are only appended to the path if
+they exist and are not already on it.
+
+Sites that wish to provide site-specific modules should place them in
+one of the site specific directories; \code{sys.prefix +
+'/lib/site-python'} is for Python source code and
+\code{sys.exec_prefix + '/lib/site-python'} is for dynamically
+loadable extension modules (shared libraries).
+
+After these path manipulations, an attempt is made to import a module
+named \code{sitecustomize}, which can perform arbitrary site-specific
+customizations. If this import fails with an \code{ImportError}
+exception, it is ignored.
+
+Note that for non-Unix systems, \code{sys.prefix} and
+\code{sys.exec_prefix} are empty, and the path manipulations are
+skipped; however the import of \code{sitecustomize} is still attempted.