Original Translation
37
As implied above, the :command:`build` command is responsible for putting the files to install into a *build directory*. By default, this is :file:`build` under the distribution root; if you're excessively concerned with speed, or want to keep the source tree pristine, you can change the build directory with the :option:`--build-base` option. For example::
38
python setup.py build --build-base=/tmp/pybuild/foo-1.0
39
(Or you could do this permanently with a directive in your system or personal Distutils configuration file; see section :ref:`inst-config-files`.) Normally, this isn't necessary.
40
The default layout for the build tree is as follows::
41
--- build/ --- lib/ or --- build/ --- lib.<plat>/ temp.<plat>/
42
where ``<plat>`` expands to a brief description of the current OS/hardware platform and Python version. The first form, with just a :file:`lib` directory, is used for "pure module distributions"---that is, module distributions that include only pure Python modules. If a module distribution contains any extensions (modules written in C/C++), then the second form, with two ``<plat>`` directories, is used. In that case, the :file:`temp.{plat}` directory holds temporary files generated by the compile/link process that don't actually get installed. In either case, the :file:`lib` (or :file:`lib.{plat}`) directory contains all Python modules (pure Python and extensions) that will be installed.
43
In the future, more directories will be added to handle Python scripts, documentation, binary executables, and whatever else is needed to handle the job of installing Python modules and applications.
44
How installation works
45
After the :command:`build` command runs (whether you run it explicitly, or the :command:`install` command does it for you), the work of the :command:`install` command is relatively simple: all it has to do is copy everything under :file:`build/lib` (or :file:`build/lib.{plat}`) to your chosen installation directory.
46
If you don't choose an installation directory---i.e., if you just run ``setup.py install``\ ---then the :command:`install` command installs to the standard location for third-party Python modules. This location varies by platform and by how you built/installed Python itself. On Unix (and Mac OS X, which is also Unix-based), it also depends on whether the module distribution being installed is pure Python or contains extensions ("non-pure"):