2007-08-15 11:28:22 -03:00
|
|
|
.. highlightlang:: none
|
|
|
|
|
|
|
|
.. _install-index:
|
|
|
|
|
2014-03-16 01:13:56 -03:00
|
|
|
********************************************
|
|
|
|
Installing Python Modules (Legacy version)
|
|
|
|
********************************************
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
:Author: Greg Ward
|
|
|
|
|
Merged revisions 59605-59624 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59606 | georg.brandl | 2007-12-29 11:57:00 +0100 (Sat, 29 Dec 2007) | 2 lines
Some cleanup in the docs.
........
r59611 | martin.v.loewis | 2007-12-29 19:49:21 +0100 (Sat, 29 Dec 2007) | 2 lines
Bug #1699: Define _BSD_SOURCE only on OpenBSD.
........
r59612 | raymond.hettinger | 2007-12-29 23:09:34 +0100 (Sat, 29 Dec 2007) | 1 line
Simpler documentation for itertools.tee(). Should be backported.
........
r59613 | raymond.hettinger | 2007-12-29 23:16:24 +0100 (Sat, 29 Dec 2007) | 1 line
Improve docs for itertools.groupby(). The use of xrange(0) to create a unique object is less obvious than object().
........
r59620 | christian.heimes | 2007-12-31 15:47:07 +0100 (Mon, 31 Dec 2007) | 3 lines
Added wininst-9.0.exe executable for VS 2008
Integrated bdist_wininst into PCBuild9 directory
........
r59621 | christian.heimes | 2007-12-31 15:51:18 +0100 (Mon, 31 Dec 2007) | 1 line
Moved PCbuild directory to PC/VS7.1
........
r59622 | christian.heimes | 2007-12-31 15:59:26 +0100 (Mon, 31 Dec 2007) | 1 line
Fix paths for build bot
........
r59623 | christian.heimes | 2007-12-31 16:02:41 +0100 (Mon, 31 Dec 2007) | 1 line
Fix paths for build bot, part 2
........
r59624 | christian.heimes | 2007-12-31 16:18:55 +0100 (Mon, 31 Dec 2007) | 1 line
Renamed PCBuild9 directory to PCBuild
........
2007-12-31 12:14:33 -04:00
|
|
|
.. TODO: Fill in XXX comments
|
|
|
|
|
2016-06-05 21:38:48 -03:00
|
|
|
.. seealso::
|
|
|
|
|
|
|
|
:ref:`installing-index`
|
|
|
|
The up to date module installation documentations
|
|
|
|
|
Merged revisions 59605-59624 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59606 | georg.brandl | 2007-12-29 11:57:00 +0100 (Sat, 29 Dec 2007) | 2 lines
Some cleanup in the docs.
........
r59611 | martin.v.loewis | 2007-12-29 19:49:21 +0100 (Sat, 29 Dec 2007) | 2 lines
Bug #1699: Define _BSD_SOURCE only on OpenBSD.
........
r59612 | raymond.hettinger | 2007-12-29 23:09:34 +0100 (Sat, 29 Dec 2007) | 1 line
Simpler documentation for itertools.tee(). Should be backported.
........
r59613 | raymond.hettinger | 2007-12-29 23:16:24 +0100 (Sat, 29 Dec 2007) | 1 line
Improve docs for itertools.groupby(). The use of xrange(0) to create a unique object is less obvious than object().
........
r59620 | christian.heimes | 2007-12-31 15:47:07 +0100 (Mon, 31 Dec 2007) | 3 lines
Added wininst-9.0.exe executable for VS 2008
Integrated bdist_wininst into PCBuild9 directory
........
r59621 | christian.heimes | 2007-12-31 15:51:18 +0100 (Mon, 31 Dec 2007) | 1 line
Moved PCbuild directory to PC/VS7.1
........
r59622 | christian.heimes | 2007-12-31 15:59:26 +0100 (Mon, 31 Dec 2007) | 1 line
Fix paths for build bot
........
r59623 | christian.heimes | 2007-12-31 16:02:41 +0100 (Mon, 31 Dec 2007) | 1 line
Fix paths for build bot, part 2
........
r59624 | christian.heimes | 2007-12-31 16:18:55 +0100 (Mon, 31 Dec 2007) | 1 line
Renamed PCBuild9 directory to PCBuild
........
2007-12-31 12:14:33 -04:00
|
|
|
.. The audience for this document includes people who don't know anything
|
|
|
|
about Python and aren't about to learn the language just in order to
|
|
|
|
install and maintain it for their users, i.e. system administrators.
|
|
|
|
Thus, I have to be sure to explain the basics at some point:
|
|
|
|
sys.path and PYTHONPATH at least. Should probably give pointers to
|
|
|
|
other docs on "import site", PYTHONSTARTUP, PYTHONHOME, etc.
|
2009-01-03 17:18:54 -04:00
|
|
|
|
Merged revisions 59605-59624 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59606 | georg.brandl | 2007-12-29 11:57:00 +0100 (Sat, 29 Dec 2007) | 2 lines
Some cleanup in the docs.
........
r59611 | martin.v.loewis | 2007-12-29 19:49:21 +0100 (Sat, 29 Dec 2007) | 2 lines
Bug #1699: Define _BSD_SOURCE only on OpenBSD.
........
r59612 | raymond.hettinger | 2007-12-29 23:09:34 +0100 (Sat, 29 Dec 2007) | 1 line
Simpler documentation for itertools.tee(). Should be backported.
........
r59613 | raymond.hettinger | 2007-12-29 23:16:24 +0100 (Sat, 29 Dec 2007) | 1 line
Improve docs for itertools.groupby(). The use of xrange(0) to create a unique object is less obvious than object().
........
r59620 | christian.heimes | 2007-12-31 15:47:07 +0100 (Mon, 31 Dec 2007) | 3 lines
Added wininst-9.0.exe executable for VS 2008
Integrated bdist_wininst into PCBuild9 directory
........
r59621 | christian.heimes | 2007-12-31 15:51:18 +0100 (Mon, 31 Dec 2007) | 1 line
Moved PCbuild directory to PC/VS7.1
........
r59622 | christian.heimes | 2007-12-31 15:59:26 +0100 (Mon, 31 Dec 2007) | 1 line
Fix paths for build bot
........
r59623 | christian.heimes | 2007-12-31 16:02:41 +0100 (Mon, 31 Dec 2007) | 1 line
Fix paths for build bot, part 2
........
r59624 | christian.heimes | 2007-12-31 16:18:55 +0100 (Mon, 31 Dec 2007) | 1 line
Renamed PCBuild9 directory to PCBuild
........
2007-12-31 12:14:33 -04:00
|
|
|
Finally, it might be useful to include all the material from my "Care
|
|
|
|
and Feeding of a Python Installation" talk in here somewhere. Yow!
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2013-12-10 07:24:55 -04:00
|
|
|
This document describes the Python Distribution Utilities ("Distutils") from the
|
|
|
|
end-user's point-of-view, describing how to extend the capabilities of a
|
|
|
|
standard Python installation by building and installing third-party Python
|
|
|
|
modules and extensions.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2013-12-10 07:24:55 -04:00
|
|
|
|
|
|
|
.. note::
|
2015-11-04 02:43:31 -04:00
|
|
|
|
2015-11-04 02:42:02 -04:00
|
|
|
This guide only covers the basic tools for building and distributing
|
|
|
|
extensions that are provided as part of this version of Python. Third party
|
|
|
|
tools offer easier to use and more secure alternatives. Refer to the `quick
|
2018-01-19 20:25:37 -04:00
|
|
|
recommendations section <https://packaging.python.org/guides/tool-recommendations/>`__
|
2013-12-10 07:24:55 -04:00
|
|
|
in the Python Packaging User Guide for more information.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. _inst-intro:
|
|
|
|
|
2015-11-04 02:42:02 -04:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
Introduction
|
|
|
|
============
|
|
|
|
|
|
|
|
Although Python's extensive standard library covers many programming needs,
|
|
|
|
there often comes a time when you need to add some new functionality to your
|
|
|
|
Python installation in the form of third-party modules. This might be necessary
|
|
|
|
to support your own programming, or to support an application that you want to
|
|
|
|
use and that happens to be written in Python.
|
|
|
|
|
|
|
|
In the past, there has been little support for adding third-party modules to an
|
|
|
|
existing Python installation. With the introduction of the Python Distribution
|
|
|
|
Utilities (Distutils for short) in Python 2.0, this changed.
|
|
|
|
|
|
|
|
This document is aimed primarily at the people who need to install third-party
|
|
|
|
Python modules: end-users and system administrators who just need to get some
|
|
|
|
Python application running, and existing Python programmers who want to add some
|
|
|
|
new goodies to their toolbox. You don't need to know Python to read this
|
|
|
|
document; there will be some brief forays into using Python's interactive mode
|
|
|
|
to explore your installation, but that's it. If you're looking for information
|
|
|
|
on how to distribute your own Python modules so that others may use them, see
|
2014-03-16 01:13:56 -03:00
|
|
|
the :ref:`distutils-index` manual. :ref:`debug-setup-script` may also be of
|
|
|
|
interest.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. _inst-trivial-install:
|
|
|
|
|
|
|
|
Best case: trivial installation
|
|
|
|
-------------------------------
|
|
|
|
|
|
|
|
In the best case, someone will have prepared a special version of the module
|
|
|
|
distribution you want to install that is targeted specifically at your platform
|
|
|
|
and is installed just like any other software on your platform. For example,
|
|
|
|
the module developer might make an executable installer available for Windows
|
|
|
|
users, an RPM package for users of RPM-based Linux systems (Red Hat, SuSE,
|
|
|
|
Mandrake, and many others), a Debian package for users of Debian-based Linux
|
|
|
|
systems, and so forth.
|
|
|
|
|
|
|
|
In that case, you would download the installer appropriate to your platform and
|
|
|
|
do the obvious thing with it: run it if it's an executable installer, ``rpm
|
|
|
|
--install`` it if it's an RPM, etc. You don't need to run Python or a setup
|
|
|
|
script, you don't need to compile anything---you might not even need to read any
|
2011-07-26 11:53:17 -03:00
|
|
|
instructions (although it's always a good idea to do so anyway).
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Of course, things will not always be that easy. You might be interested in a
|
|
|
|
module distribution that doesn't have an easy-to-use installer for your
|
|
|
|
platform. In that case, you'll have to start with the source distribution
|
|
|
|
released by the module's author/maintainer. Installing from a source
|
|
|
|
distribution is not too hard, as long as the modules are packaged in the
|
|
|
|
standard way. The bulk of this document is about building and installing
|
|
|
|
modules from standard source distributions.
|
|
|
|
|
|
|
|
|
|
|
|
.. _inst-new-standard:
|
|
|
|
|
|
|
|
The new standard: Distutils
|
|
|
|
---------------------------
|
|
|
|
|
|
|
|
If you download a module source distribution, you can tell pretty quickly if it
|
|
|
|
was packaged and distributed in the standard way, i.e. using the Distutils.
|
|
|
|
First, the distribution's name and version number will be featured prominently
|
|
|
|
in the name of the downloaded archive, e.g. :file:`foo-1.0.tar.gz` or
|
|
|
|
:file:`widget-0.9.7.zip`. Next, the archive will unpack into a similarly-named
|
|
|
|
directory: :file:`foo-1.0` or :file:`widget-0.9.7`. Additionally, the
|
|
|
|
distribution will contain a setup script :file:`setup.py`, and a file named
|
|
|
|
:file:`README.txt` or possibly just :file:`README`, which should explain that
|
2011-06-07 20:11:36 -03:00
|
|
|
building and installing the module distribution is a simple matter of running
|
|
|
|
one command from a terminal::
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
python setup.py install
|
|
|
|
|
2011-08-19 04:28:46 -03:00
|
|
|
For Windows, this command should be run from a command prompt window
|
2011-08-18 22:12:38 -03:00
|
|
|
(:menuselection:`Start --> Accessories`)::
|
2011-06-07 20:11:36 -03:00
|
|
|
|
|
|
|
setup.py install
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
If all these things are true, then you already know how to build and install the
|
|
|
|
modules you've just downloaded: Run the command above. Unless you need to
|
|
|
|
install things in a non-standard way or customize the build process, you don't
|
|
|
|
really need this manual. Or rather, the above command is everything you need to
|
|
|
|
get out of this manual.
|
|
|
|
|
|
|
|
|
|
|
|
.. _inst-standard-install:
|
|
|
|
|
|
|
|
Standard Build and Install
|
|
|
|
==========================
|
|
|
|
|
|
|
|
As described in section :ref:`inst-new-standard`, building and installing a module
|
2011-06-07 20:11:36 -03:00
|
|
|
distribution using the Distutils is usually one simple command to run from a
|
|
|
|
terminal::
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
python setup.py install
|
|
|
|
|
|
|
|
|
|
|
|
.. _inst-platform-variations:
|
|
|
|
|
|
|
|
Platform variations
|
|
|
|
-------------------
|
|
|
|
|
|
|
|
You should always run the setup command from the distribution root directory,
|
|
|
|
i.e. the top-level subdirectory that the module source distribution unpacks
|
|
|
|
into. For example, if you've just downloaded a module source distribution
|
|
|
|
:file:`foo-1.0.tar.gz` onto a Unix system, the normal thing to do is::
|
|
|
|
|
|
|
|
gunzip -c foo-1.0.tar.gz | tar xf - # unpacks into directory foo-1.0
|
|
|
|
cd foo-1.0
|
|
|
|
python setup.py install
|
|
|
|
|
|
|
|
On Windows, you'd probably download :file:`foo-1.0.zip`. If you downloaded the
|
|
|
|
archive file to :file:`C:\\Temp`, then it would unpack into
|
2015-11-02 08:10:23 -04:00
|
|
|
:file:`C:\\Temp\\foo-1.0`; you can use either an archive manipulator with a
|
2007-08-15 11:28:22 -03:00
|
|
|
graphical user interface (such as WinZip) or a command-line tool (such as
|
|
|
|
:program:`unzip` or :program:`pkunzip`) to unpack the archive. Then, open a
|
2011-08-18 22:12:38 -03:00
|
|
|
command prompt window and run::
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
cd c:\Temp\foo-1.0
|
|
|
|
python setup.py install
|
|
|
|
|
|
|
|
|
|
|
|
.. _inst-splitting-up:
|
|
|
|
|
|
|
|
Splitting the job up
|
|
|
|
--------------------
|
|
|
|
|
|
|
|
Running ``setup.py install`` builds and installs all modules in one run. If you
|
|
|
|
prefer to work incrementally---especially useful if you want to customize the
|
|
|
|
build process, or if things are going wrong---you can use the setup script to do
|
|
|
|
one thing at a time. This is particularly helpful when the build and install
|
|
|
|
will be done by different users---for example, you might want to build a module
|
|
|
|
distribution and hand it off to a system administrator for installation (or do
|
|
|
|
it yourself, with super-user privileges).
|
|
|
|
|
|
|
|
For example, you can build everything in one step, and then install everything
|
|
|
|
in a second step, by invoking the setup script twice::
|
|
|
|
|
|
|
|
python setup.py build
|
|
|
|
python setup.py install
|
|
|
|
|
|
|
|
If you do this, you will notice that running the :command:`install` command
|
|
|
|
first runs the :command:`build` command, which---in this case---quickly notices
|
|
|
|
that it has nothing to do, since everything in the :file:`build` directory is
|
|
|
|
up-to-date.
|
|
|
|
|
|
|
|
You may not need this ability to break things down often if all you do is
|
|
|
|
install modules downloaded off the 'net, but it's very handy for more advanced
|
|
|
|
tasks. If you get into distributing your own Python modules and extensions,
|
|
|
|
you'll run lots of individual Distutils commands on their own.
|
|
|
|
|
|
|
|
|
|
|
|
.. _inst-how-build-works:
|
|
|
|
|
|
|
|
How building works
|
|
|
|
------------------
|
|
|
|
|
|
|
|
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
|
2016-10-30 01:20:17 -03:00
|
|
|
:option:`!--build-base` option. For example::
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2013-02-23 14:26:56 -04:00
|
|
|
python setup.py build --build-base=/path/to/pybuild/foo-1.0
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
(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.
|
|
|
|
|
|
|
|
The default layout for the build tree is as follows::
|
|
|
|
|
|
|
|
--- build/ --- lib/
|
|
|
|
or
|
|
|
|
--- build/ --- lib.<plat>/
|
|
|
|
temp.<plat>/
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
.. _inst-how-install-works:
|
|
|
|
|
|
|
|
How installation works
|
|
|
|
----------------------
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
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"):
|
|
|
|
|
2013-03-28 09:28:44 -03:00
|
|
|
.. tabularcolumns:: |l|l|l|l|
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
+-----------------+-----------------------------------------------------+--------------------------------------------------+-------+
|
|
|
|
| Platform | Standard installation location | Default value | Notes |
|
|
|
|
+=================+=====================================================+==================================================+=======+
|
|
|
|
| Unix (pure) | :file:`{prefix}/lib/python{X.Y}/site-packages` | :file:`/usr/local/lib/python{X.Y}/site-packages` | \(1) |
|
|
|
|
+-----------------+-----------------------------------------------------+--------------------------------------------------+-------+
|
|
|
|
| Unix (non-pure) | :file:`{exec-prefix}/lib/python{X.Y}/site-packages` | :file:`/usr/local/lib/python{X.Y}/site-packages` | \(1) |
|
|
|
|
+-----------------+-----------------------------------------------------+--------------------------------------------------+-------+
|
2011-05-03 23:57:00 -03:00
|
|
|
| Windows | :file:`{prefix}\\Lib\\site-packages` | :file:`C:\\Python{XY}\\Lib\\site-packages` | \(2) |
|
2007-08-15 11:28:22 -03:00
|
|
|
+-----------------+-----------------------------------------------------+--------------------------------------------------+-------+
|
|
|
|
|
|
|
|
Notes:
|
|
|
|
|
|
|
|
(1)
|
|
|
|
Most Linux distributions include Python as a standard part of the system, so
|
|
|
|
:file:`{prefix}` and :file:`{exec-prefix}` are usually both :file:`/usr` on
|
|
|
|
Linux. If you build Python yourself on Linux (or any Unix-like system), the
|
|
|
|
default :file:`{prefix}` and :file:`{exec-prefix}` are :file:`/usr/local`.
|
|
|
|
|
|
|
|
(2)
|
|
|
|
The default installation directory on Windows was :file:`C:\\Program
|
|
|
|
Files\\Python` under Python 1.6a1, 1.5.2, and earlier.
|
|
|
|
|
|
|
|
:file:`{prefix}` and :file:`{exec-prefix}` stand for the directories that Python
|
|
|
|
is installed to, and where it finds its libraries at run-time. They are always
|
|
|
|
the same under Windows, and very often the same under Unix and Mac OS X. You
|
|
|
|
can find out what your Python installation uses for :file:`{prefix}` and
|
|
|
|
:file:`{exec-prefix}` by running Python in interactive mode and typing a few
|
|
|
|
simple commands. Under Unix, just type ``python`` at the shell prompt. Under
|
|
|
|
Windows, choose :menuselection:`Start --> Programs --> Python X.Y -->
|
|
|
|
Python (command line)`. Once the interpreter is started, you type Python code
|
|
|
|
at the prompt. For example, on my Linux system, I type the three Python
|
|
|
|
statements shown below, and get the output as shown, to find out my
|
2018-04-09 11:56:44 -03:00
|
|
|
:file:`{prefix}` and :file:`{exec-prefix}`:
|
|
|
|
|
|
|
|
.. code-block:: pycon
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2009-01-03 17:18:54 -04:00
|
|
|
Python 2.4 (#26, Aug 7 2004, 17:19:02)
|
2007-08-15 11:28:22 -03:00
|
|
|
Type "help", "copyright", "credits" or "license" for more information.
|
|
|
|
>>> import sys
|
|
|
|
>>> sys.prefix
|
|
|
|
'/usr'
|
|
|
|
>>> sys.exec_prefix
|
|
|
|
'/usr'
|
|
|
|
|
2011-08-06 11:30:42 -03:00
|
|
|
A few other placeholders are used in this document: :file:`{X.Y}` stands for the
|
|
|
|
version of Python, for example ``3.2``; :file:`{abiflags}` will be replaced by
|
|
|
|
the value of :data:`sys.abiflags` or the empty string for platforms which don't
|
|
|
|
define ABI flags; :file:`{distname}` will be replaced by the name of the module
|
|
|
|
distribution being installed. Dots and capitalization are important in the
|
|
|
|
paths; for example, a value that uses ``python3.2`` on UNIX will typically use
|
|
|
|
``Python32`` on Windows.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
If you don't want to install modules to the standard location, or if you don't
|
|
|
|
have permission to write there, then you need to read about alternate
|
|
|
|
installations in section :ref:`inst-alt-install`. If you want to customize your
|
|
|
|
installation directories more heavily, see section :ref:`inst-custom-install` on
|
|
|
|
custom installations.
|
|
|
|
|
|
|
|
|
|
|
|
.. _inst-alt-install:
|
|
|
|
|
|
|
|
Alternate Installation
|
|
|
|
======================
|
|
|
|
|
|
|
|
Often, it is necessary or desirable to install modules to a location other than
|
|
|
|
the standard location for third-party Python modules. For example, on a Unix
|
|
|
|
system you might not have permission to write to the standard third-party module
|
|
|
|
directory. Or you might wish to try out a module before making it a standard
|
|
|
|
part of your local Python installation. This is especially true when upgrading
|
|
|
|
a distribution already present: you want to make sure your existing base of
|
|
|
|
scripts still works with the new version before actually upgrading.
|
|
|
|
|
|
|
|
The Distutils :command:`install` command is designed to make installing module
|
|
|
|
distributions to an alternate location simple and painless. The basic idea is
|
|
|
|
that you supply a base directory for the installation, and the
|
|
|
|
:command:`install` command picks a set of directories (called an *installation
|
|
|
|
scheme*) under this base directory in which to install files. The details
|
|
|
|
differ across platforms, so read whichever of the following sections applies to
|
|
|
|
you.
|
|
|
|
|
2011-08-06 11:30:42 -03:00
|
|
|
Note that the various alternate installation schemes are mutually exclusive: you
|
|
|
|
can pass ``--user``, or ``--home``, or ``--prefix`` and ``--exec-prefix``, or
|
|
|
|
``--install-base`` and ``--install-platbase``, but you can't mix from these
|
|
|
|
groups.
|
|
|
|
|
|
|
|
|
|
|
|
.. _inst-alt-install-user:
|
|
|
|
|
|
|
|
Alternate installation: the user scheme
|
|
|
|
---------------------------------------
|
|
|
|
|
|
|
|
This scheme is designed to be the most convenient solution for users that don't
|
|
|
|
have write permission to the global site-packages directory or don't want to
|
|
|
|
install into it. It is enabled with a simple option::
|
|
|
|
|
|
|
|
python setup.py install --user
|
|
|
|
|
|
|
|
Files will be installed into subdirectories of :data:`site.USER_BASE` (written
|
|
|
|
as :file:`{userbase}` hereafter). This scheme installs pure Python modules and
|
|
|
|
extension modules in the same location (also known as :data:`site.USER_SITE`).
|
|
|
|
Here are the values for UNIX, including Mac OS X:
|
|
|
|
|
|
|
|
=============== ===========================================================
|
|
|
|
Type of file Installation directory
|
|
|
|
=============== ===========================================================
|
|
|
|
modules :file:`{userbase}/lib/python{X.Y}/site-packages`
|
|
|
|
scripts :file:`{userbase}/bin`
|
|
|
|
data :file:`{userbase}`
|
|
|
|
C headers :file:`{userbase}/include/python{X.Y}{abiflags}/{distname}`
|
|
|
|
=============== ===========================================================
|
|
|
|
|
|
|
|
And here are the values used on Windows:
|
|
|
|
|
|
|
|
=============== ===========================================================
|
|
|
|
Type of file Installation directory
|
|
|
|
=============== ===========================================================
|
|
|
|
modules :file:`{userbase}\\Python{XY}\\site-packages`
|
2015-02-14 13:50:59 -04:00
|
|
|
scripts :file:`{userbase}\\Python{XY}\\Scripts`
|
2011-08-06 11:30:42 -03:00
|
|
|
data :file:`{userbase}`
|
|
|
|
C headers :file:`{userbase}\\Python{XY}\\Include\\{distname}`
|
|
|
|
=============== ===========================================================
|
|
|
|
|
|
|
|
The advantage of using this scheme compared to the other ones described below is
|
|
|
|
that the user site-packages directory is under normal conditions always included
|
|
|
|
in :data:`sys.path` (see :mod:`site` for more information), which means that
|
|
|
|
there is no additional step to perform after running the :file:`setup.py` script
|
|
|
|
to finalize the installation.
|
|
|
|
|
|
|
|
The :command:`build_ext` command also has a ``--user`` option to add
|
|
|
|
:file:`{userbase}/include` to the compiler search path for header files and
|
|
|
|
:file:`{userbase}/lib` to the compiler search path for libraries as well as to
|
|
|
|
the runtime search path for shared C libraries (rpath).
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2011-08-06 11:30:42 -03:00
|
|
|
|
|
|
|
.. _inst-alt-install-home:
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Alternate installation: the home scheme
|
|
|
|
---------------------------------------
|
|
|
|
|
|
|
|
The idea behind the "home scheme" is that you build and maintain a personal
|
|
|
|
stash of Python modules. This scheme's name is derived from the idea of a
|
|
|
|
"home" directory on Unix, since it's not unusual for a Unix user to make their
|
|
|
|
home directory have a layout similar to :file:`/usr/` or :file:`/usr/local/`.
|
2010-07-26 12:11:49 -03:00
|
|
|
This scheme can be used by anyone, regardless of the operating system they
|
|
|
|
are installing for.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Installing a new module distribution is as simple as ::
|
|
|
|
|
|
|
|
python setup.py install --home=<dir>
|
|
|
|
|
2016-10-30 01:20:17 -03:00
|
|
|
where you can supply any directory you like for the :option:`!--home` option. On
|
2007-08-15 11:28:22 -03:00
|
|
|
Unix, lazy typists can just type a tilde (``~``); the :command:`install` command
|
|
|
|
will expand this to your home directory::
|
|
|
|
|
|
|
|
python setup.py install --home=~
|
|
|
|
|
2011-08-06 11:30:42 -03:00
|
|
|
To make Python find the distributions installed with this scheme, you may have
|
|
|
|
to :ref:`modify Python's search path <inst-search-path>` or edit
|
|
|
|
:mod:`sitecustomize` (see :mod:`site`) to call :func:`site.addsitedir` or edit
|
|
|
|
:data:`sys.path`.
|
|
|
|
|
2016-10-30 01:20:17 -03:00
|
|
|
The :option:`!--home` option defines the installation base directory. Files are
|
2007-08-15 11:28:22 -03:00
|
|
|
installed to the following directories under the installation base as follows:
|
|
|
|
|
2011-08-06 11:30:42 -03:00
|
|
|
=============== ===========================================================
|
|
|
|
Type of file Installation directory
|
|
|
|
=============== ===========================================================
|
|
|
|
modules :file:`{home}/lib/python`
|
|
|
|
scripts :file:`{home}/bin`
|
|
|
|
data :file:`{home}`
|
|
|
|
C headers :file:`{home}/include/python/{distname}`
|
|
|
|
=============== ===========================================================
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2011-08-06 11:30:42 -03:00
|
|
|
(Mentally replace slashes with backslashes if you're on Windows.)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2011-08-06 11:30:42 -03:00
|
|
|
|
|
|
|
.. _inst-alt-install-prefix-unix:
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Alternate installation: Unix (the prefix scheme)
|
|
|
|
------------------------------------------------
|
|
|
|
|
|
|
|
The "prefix scheme" is useful when you wish to use one Python installation to
|
|
|
|
perform the build/install (i.e., to run the setup script), but install modules
|
|
|
|
into the third-party module directory of a different Python installation (or
|
|
|
|
something that looks like a different Python installation). If this sounds a
|
2011-08-06 11:30:42 -03:00
|
|
|
trifle unusual, it is---that's why the user and home schemes come before. However,
|
2007-08-15 11:28:22 -03:00
|
|
|
there are at least two known cases where the prefix scheme will be useful.
|
|
|
|
|
|
|
|
First, consider that many Linux distributions put Python in :file:`/usr`, rather
|
|
|
|
than the more traditional :file:`/usr/local`. This is entirely appropriate,
|
|
|
|
since in those cases Python is part of "the system" rather than a local add-on.
|
|
|
|
However, if you are installing Python modules from source, you probably want
|
|
|
|
them to go in :file:`/usr/local/lib/python2.{X}` rather than
|
|
|
|
:file:`/usr/lib/python2.{X}`. This can be done with ::
|
|
|
|
|
|
|
|
/usr/bin/python setup.py install --prefix=/usr/local
|
|
|
|
|
|
|
|
Another possibility is a network filesystem where the name used to write to a
|
|
|
|
remote directory is different from the name used to read it: for example, the
|
|
|
|
Python interpreter accessed as :file:`/usr/local/bin/python` might search for
|
|
|
|
modules in :file:`/usr/local/lib/python2.{X}`, but those modules would have to
|
|
|
|
be installed to, say, :file:`/mnt/{@server}/export/lib/python2.{X}`. This could
|
|
|
|
be done with ::
|
|
|
|
|
|
|
|
/usr/local/bin/python setup.py install --prefix=/mnt/@server/export
|
|
|
|
|
2016-10-30 01:20:17 -03:00
|
|
|
In either case, the :option:`!--prefix` option defines the installation base, and
|
|
|
|
the :option:`!--exec-prefix` option defines the platform-specific installation
|
2007-08-15 11:28:22 -03:00
|
|
|
base, which is used for platform-specific files. (Currently, this just means
|
|
|
|
non-pure module distributions, but could be expanded to C libraries, binary
|
2016-10-30 01:20:17 -03:00
|
|
|
executables, etc.) If :option:`!--exec-prefix` is not supplied, it defaults to
|
|
|
|
:option:`!--prefix`. Files are installed as follows:
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2011-08-06 11:30:42 -03:00
|
|
|
================= ==========================================================
|
|
|
|
Type of file Installation directory
|
|
|
|
================= ==========================================================
|
|
|
|
Python modules :file:`{prefix}/lib/python{X.Y}/site-packages`
|
|
|
|
extension modules :file:`{exec-prefix}/lib/python{X.Y}/site-packages`
|
|
|
|
scripts :file:`{prefix}/bin`
|
|
|
|
data :file:`{prefix}`
|
|
|
|
C headers :file:`{prefix}/include/python{X.Y}{abiflags}/{distname}`
|
|
|
|
================= ==========================================================
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2016-10-30 01:20:17 -03:00
|
|
|
There is no requirement that :option:`!--prefix` or :option:`!--exec-prefix`
|
2007-08-15 11:28:22 -03:00
|
|
|
actually point to an alternate Python installation; if the directories listed
|
|
|
|
above do not already exist, they are created at installation time.
|
|
|
|
|
|
|
|
Incidentally, the real reason the prefix scheme is important is simply that a
|
2016-10-30 01:20:17 -03:00
|
|
|
standard Unix installation uses the prefix scheme, but with :option:`!--prefix`
|
|
|
|
and :option:`!--exec-prefix` supplied by Python itself as ``sys.prefix`` and
|
2007-08-15 11:28:22 -03:00
|
|
|
``sys.exec_prefix``. Thus, you might think you'll never use the prefix scheme,
|
|
|
|
but every time you run ``python setup.py install`` without any other options,
|
|
|
|
you're using it.
|
|
|
|
|
|
|
|
Note that installing extensions to an alternate Python installation has no
|
|
|
|
effect on how those extensions are built: in particular, the Python header files
|
|
|
|
(:file:`Python.h` and friends) installed with the Python interpreter used to run
|
|
|
|
the setup script will be used in compiling extensions. It is your
|
|
|
|
responsibility to ensure that the interpreter used to run extensions installed
|
|
|
|
in this way is compatible with the interpreter used to build them. The best way
|
|
|
|
to do this is to ensure that the two interpreters are the same version of Python
|
|
|
|
(possibly different builds, or possibly copies of the same build). (Of course,
|
2016-10-30 01:20:17 -03:00
|
|
|
if your :option:`!--prefix` and :option:`!--exec-prefix` don't even point to an
|
2007-08-15 11:28:22 -03:00
|
|
|
alternate Python installation, this is immaterial.)
|
|
|
|
|
|
|
|
|
2011-08-06 11:30:42 -03:00
|
|
|
.. _inst-alt-install-prefix-windows:
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Alternate installation: Windows (the prefix scheme)
|
|
|
|
---------------------------------------------------
|
|
|
|
|
|
|
|
Windows has no concept of a user's home directory, and since the standard Python
|
2016-10-30 01:20:17 -03:00
|
|
|
installation under Windows is simpler than under Unix, the :option:`!--prefix`
|
2007-08-15 11:28:22 -03:00
|
|
|
option has traditionally been used to install additional packages in separate
|
|
|
|
locations on Windows. ::
|
|
|
|
|
|
|
|
python setup.py install --prefix="\Temp\Python"
|
|
|
|
|
|
|
|
to install modules to the :file:`\\Temp\\Python` directory on the current drive.
|
|
|
|
|
2016-10-30 01:20:17 -03:00
|
|
|
The installation base is defined by the :option:`!--prefix` option; the
|
|
|
|
:option:`!--exec-prefix` option is not supported under Windows, which means that
|
2011-08-06 11:30:42 -03:00
|
|
|
pure Python modules and extension modules are installed into the same location.
|
|
|
|
Files are installed as follows:
|
|
|
|
|
|
|
|
=============== ==========================================================
|
|
|
|
Type of file Installation directory
|
|
|
|
=============== ==========================================================
|
|
|
|
modules :file:`{prefix}\\Lib\\site-packages`
|
|
|
|
scripts :file:`{prefix}\\Scripts`
|
|
|
|
data :file:`{prefix}`
|
|
|
|
C headers :file:`{prefix}\\Include\\{distname}`
|
|
|
|
=============== ==========================================================
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. _inst-custom-install:
|
|
|
|
|
|
|
|
Custom Installation
|
|
|
|
===================
|
|
|
|
|
|
|
|
Sometimes, the alternate installation schemes described in section
|
|
|
|
:ref:`inst-alt-install` just don't do what you want. You might want to tweak just
|
|
|
|
one or two directories while keeping everything under the same base directory,
|
|
|
|
or you might want to completely redefine the installation scheme. In either
|
|
|
|
case, you're creating a *custom installation scheme*.
|
|
|
|
|
2011-08-06 11:30:42 -03:00
|
|
|
To create a custom installation scheme, you start with one of the alternate
|
|
|
|
schemes and override some of the installation directories used for the various
|
|
|
|
types of files, using these options:
|
|
|
|
|
|
|
|
====================== =======================
|
|
|
|
Type of file Override option
|
|
|
|
====================== =======================
|
|
|
|
Python modules ``--install-purelib``
|
|
|
|
extension modules ``--install-platlib``
|
|
|
|
all modules ``--install-lib``
|
|
|
|
scripts ``--install-scripts``
|
|
|
|
data ``--install-data``
|
|
|
|
C headers ``--install-headers``
|
|
|
|
====================== =======================
|
|
|
|
|
|
|
|
These override options can be relative, absolute,
|
2007-08-15 11:28:22 -03:00
|
|
|
or explicitly defined in terms of one of the installation base directories.
|
|
|
|
(There are two installation base directories, and they are normally the same---
|
|
|
|
they only differ when you use the Unix "prefix scheme" and supply different
|
2011-08-06 11:30:42 -03:00
|
|
|
``--prefix`` and ``--exec-prefix`` options; using ``--install-lib`` will
|
|
|
|
override values computed or given for ``--install-purelib`` and
|
|
|
|
``--install-platlib``, and is recommended for schemes that don't make a
|
|
|
|
difference between Python and extension modules.)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
For example, say you're installing a module distribution to your home directory
|
|
|
|
under Unix---but you want scripts to go in :file:`~/scripts` rather than
|
|
|
|
:file:`~/bin`. As you might expect, you can override this directory with the
|
2016-10-30 01:20:17 -03:00
|
|
|
:option:`!--install-scripts` option; in this case, it makes most sense to supply
|
2007-08-15 11:28:22 -03:00
|
|
|
a relative path, which will be interpreted relative to the installation base
|
|
|
|
directory (your home directory, in this case)::
|
|
|
|
|
|
|
|
python setup.py install --home=~ --install-scripts=scripts
|
|
|
|
|
|
|
|
Another Unix example: suppose your Python installation was built and installed
|
|
|
|
with a prefix of :file:`/usr/local/python`, so under a standard installation
|
|
|
|
scripts will wind up in :file:`/usr/local/python/bin`. If you want them in
|
|
|
|
:file:`/usr/local/bin` instead, you would supply this absolute directory for the
|
2016-10-30 01:20:17 -03:00
|
|
|
:option:`!--install-scripts` option::
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
python setup.py install --install-scripts=/usr/local/bin
|
|
|
|
|
|
|
|
(This performs an installation using the "prefix scheme," where the prefix is
|
|
|
|
whatever your Python interpreter was installed with--- :file:`/usr/local/python`
|
|
|
|
in this case.)
|
|
|
|
|
|
|
|
If you maintain Python on Windows, you might want third-party modules to live in
|
|
|
|
a subdirectory of :file:`{prefix}`, rather than right in :file:`{prefix}`
|
|
|
|
itself. This is almost as easy as customizing the script installation directory
|
|
|
|
---you just have to remember that there are two types of modules to worry about,
|
2011-08-06 11:30:42 -03:00
|
|
|
Python and extension modules, which can conveniently be both controlled by one
|
|
|
|
option::
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2011-08-06 11:30:42 -03:00
|
|
|
python setup.py install --install-lib=Site
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2011-08-06 11:30:42 -03:00
|
|
|
The specified installation directory is relative to :file:`{prefix}`. Of
|
|
|
|
course, you also have to ensure that this directory is in Python's module
|
|
|
|
search path, such as by putting a :file:`.pth` file in a site directory (see
|
|
|
|
:mod:`site`). See section :ref:`inst-search-path` to find out how to modify
|
|
|
|
Python's search path.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
If you want to define an entire installation scheme, you just have to supply all
|
|
|
|
of the installation directory options. The recommended way to do this is to
|
|
|
|
supply relative paths; for example, if you want to maintain all Python
|
|
|
|
module-related files under :file:`python` in your home directory, and you want a
|
|
|
|
separate directory for each platform that you use your home directory from, you
|
|
|
|
might define the following installation scheme::
|
|
|
|
|
|
|
|
python setup.py install --home=~ \
|
|
|
|
--install-purelib=python/lib \
|
|
|
|
--install-platlib=python/lib.$PLAT \
|
|
|
|
--install-scripts=python/scripts
|
|
|
|
--install-data=python/data
|
|
|
|
|
2007-08-31 14:17:17 -03:00
|
|
|
or, equivalently, ::
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
python setup.py install --home=~/python \
|
|
|
|
--install-purelib=lib \
|
|
|
|
--install-platlib='lib.$PLAT' \
|
|
|
|
--install-scripts=scripts
|
|
|
|
--install-data=data
|
|
|
|
|
|
|
|
``$PLAT`` is not (necessarily) an environment variable---it will be expanded by
|
|
|
|
the Distutils as it parses your command line options, just as it does when
|
|
|
|
parsing your configuration file(s).
|
|
|
|
|
|
|
|
Obviously, specifying the entire installation scheme every time you install a
|
|
|
|
new module distribution would be very tedious. Thus, you can put these options
|
2018-04-09 11:56:44 -03:00
|
|
|
into your Distutils config file (see section :ref:`inst-config-files`):
|
|
|
|
|
|
|
|
.. code-block:: ini
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
[install]
|
|
|
|
install-base=$HOME
|
|
|
|
install-purelib=python/lib
|
|
|
|
install-platlib=python/lib.$PLAT
|
|
|
|
install-scripts=python/scripts
|
|
|
|
install-data=python/data
|
|
|
|
|
2018-04-09 11:56:44 -03:00
|
|
|
or, equivalently,
|
|
|
|
|
|
|
|
.. code-block:: ini
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
[install]
|
|
|
|
install-base=$HOME/python
|
|
|
|
install-purelib=lib
|
|
|
|
install-platlib=lib.$PLAT
|
|
|
|
install-scripts=scripts
|
|
|
|
install-data=data
|
|
|
|
|
|
|
|
Note that these two are *not* equivalent if you supply a different installation
|
|
|
|
base directory when you run the setup script. For example, ::
|
|
|
|
|
|
|
|
python setup.py install --install-base=/tmp
|
|
|
|
|
2011-08-06 11:30:42 -03:00
|
|
|
would install pure modules to :file:`/tmp/python/lib` in the first case, and
|
|
|
|
to :file:`/tmp/lib` in the second case. (For the second case, you probably
|
2007-08-15 11:28:22 -03:00
|
|
|
want to supply an installation base of :file:`/tmp/python`.)
|
|
|
|
|
|
|
|
You probably noticed the use of ``$HOME`` and ``$PLAT`` in the sample
|
|
|
|
configuration file input. These are Distutils configuration variables, which
|
|
|
|
bear a strong resemblance to environment variables. In fact, you can use
|
|
|
|
environment variables in config files on platforms that have such a notion but
|
|
|
|
the Distutils additionally define a few extra variables that may not be in your
|
|
|
|
environment, such as ``$PLAT``. (And of course, on systems that don't have
|
|
|
|
environment variables, such as Mac OS 9, the configuration variables supplied by
|
|
|
|
the Distutils are the only ones you can use.) See section :ref:`inst-config-files`
|
|
|
|
for details.
|
|
|
|
|
2013-05-12 07:36:07 -03:00
|
|
|
.. note:: When a :ref:`virtual environment <venv-def>` is activated, any options
|
|
|
|
that change the installation path will be ignored from all distutils configuration
|
|
|
|
files to prevent inadvertently installing projects outside of the virtual
|
|
|
|
environment.
|
|
|
|
|
Merged revisions 59605-59624 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59606 | georg.brandl | 2007-12-29 11:57:00 +0100 (Sat, 29 Dec 2007) | 2 lines
Some cleanup in the docs.
........
r59611 | martin.v.loewis | 2007-12-29 19:49:21 +0100 (Sat, 29 Dec 2007) | 2 lines
Bug #1699: Define _BSD_SOURCE only on OpenBSD.
........
r59612 | raymond.hettinger | 2007-12-29 23:09:34 +0100 (Sat, 29 Dec 2007) | 1 line
Simpler documentation for itertools.tee(). Should be backported.
........
r59613 | raymond.hettinger | 2007-12-29 23:16:24 +0100 (Sat, 29 Dec 2007) | 1 line
Improve docs for itertools.groupby(). The use of xrange(0) to create a unique object is less obvious than object().
........
r59620 | christian.heimes | 2007-12-31 15:47:07 +0100 (Mon, 31 Dec 2007) | 3 lines
Added wininst-9.0.exe executable for VS 2008
Integrated bdist_wininst into PCBuild9 directory
........
r59621 | christian.heimes | 2007-12-31 15:51:18 +0100 (Mon, 31 Dec 2007) | 1 line
Moved PCbuild directory to PC/VS7.1
........
r59622 | christian.heimes | 2007-12-31 15:59:26 +0100 (Mon, 31 Dec 2007) | 1 line
Fix paths for build bot
........
r59623 | christian.heimes | 2007-12-31 16:02:41 +0100 (Mon, 31 Dec 2007) | 1 line
Fix paths for build bot, part 2
........
r59624 | christian.heimes | 2007-12-31 16:18:55 +0100 (Mon, 31 Dec 2007) | 1 line
Renamed PCBuild9 directory to PCBuild
........
2007-12-31 12:14:33 -04:00
|
|
|
.. XXX need some Windows examples---when would custom installation schemes be
|
|
|
|
needed on those platforms?
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2011-08-06 11:30:42 -03:00
|
|
|
.. XXX Move this to Doc/using
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
.. _inst-search-path:
|
|
|
|
|
|
|
|
Modifying Python's Search Path
|
|
|
|
------------------------------
|
|
|
|
|
|
|
|
When the Python interpreter executes an :keyword:`import` statement, it searches
|
|
|
|
for both Python code and extension modules along a search path. A default value
|
|
|
|
for the path is configured into the Python binary when the interpreter is built.
|
|
|
|
You can determine the path by importing the :mod:`sys` module and printing the
|
|
|
|
value of ``sys.path``. ::
|
|
|
|
|
|
|
|
$ python
|
|
|
|
Python 2.2 (#11, Oct 3 2002, 13:31:27)
|
|
|
|
[GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2
|
Merged revisions 68162,68166,68171,68176,68195-68196,68210,68232 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68162 | ronald.oussoren | 2009-01-02 16:06:00 +0100 (Fri, 02 Jan 2009) | 3 lines
Fix for issue 4472 is incompatible with Cygwin, this patch
should fix that.
........
r68166 | benjamin.peterson | 2009-01-02 19:26:23 +0100 (Fri, 02 Jan 2009) | 1 line
document PyMemberDef
........
r68171 | georg.brandl | 2009-01-02 21:25:14 +0100 (Fri, 02 Jan 2009) | 3 lines
#4811: fix markup glitches (mostly remains of the conversion),
found by Gabriel Genellina.
........
r68176 | andrew.kuchling | 2009-01-02 22:00:35 +0100 (Fri, 02 Jan 2009) | 1 line
Add various items
........
r68195 | georg.brandl | 2009-01-03 14:45:15 +0100 (Sat, 03 Jan 2009) | 2 lines
Remove useless string literal.
........
r68196 | georg.brandl | 2009-01-03 15:29:53 +0100 (Sat, 03 Jan 2009) | 2 lines
Fix indentation.
........
r68210 | georg.brandl | 2009-01-03 20:10:12 +0100 (Sat, 03 Jan 2009) | 2 lines
Set eol-style correctly for mp_distributing.py.
........
r68232 | georg.brandl | 2009-01-03 22:52:16 +0100 (Sat, 03 Jan 2009) | 2 lines
Grammar fix.
........
2009-01-03 18:47:39 -04:00
|
|
|
Type "help", "copyright", "credits" or "license" for more information.
|
2007-08-15 11:28:22 -03:00
|
|
|
>>> import sys
|
|
|
|
>>> sys.path
|
2009-01-03 17:18:54 -04:00
|
|
|
['', '/usr/local/lib/python2.3', '/usr/local/lib/python2.3/plat-linux2',
|
|
|
|
'/usr/local/lib/python2.3/lib-tk', '/usr/local/lib/python2.3/lib-dynload',
|
2007-08-15 11:28:22 -03:00
|
|
|
'/usr/local/lib/python2.3/site-packages']
|
|
|
|
>>>
|
|
|
|
|
|
|
|
The null string in ``sys.path`` represents the current working directory.
|
|
|
|
|
|
|
|
The expected convention for locally installed packages is to put them in the
|
|
|
|
:file:`{...}/site-packages/` directory, but you may want to install Python
|
|
|
|
modules into some arbitrary directory. For example, your site may have a
|
|
|
|
convention of keeping all software related to the web server under :file:`/www`.
|
|
|
|
Add-on Python modules might then belong in :file:`/www/python`, and in order to
|
|
|
|
import them, this directory must be added to ``sys.path``. There are several
|
|
|
|
different ways to add the directory.
|
|
|
|
|
|
|
|
The most convenient way is to add a path configuration file to a directory
|
|
|
|
that's already on Python's path, usually to the :file:`.../site-packages/`
|
|
|
|
directory. Path configuration files have an extension of :file:`.pth`, and each
|
|
|
|
line must contain a single path that will be appended to ``sys.path``. (Because
|
|
|
|
the new paths are appended to ``sys.path``, modules in the added directories
|
|
|
|
will not override standard modules. This means you can't use this mechanism for
|
|
|
|
installing fixed versions of standard modules.)
|
|
|
|
|
|
|
|
Paths can be absolute or relative, in which case they're relative to the
|
Merged revisions 59005-59040 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
I've tried to fix test_cmd_line_script but I wasn't able to get all tests
right. Nick, can you please have a look?
........
r59020 | facundo.batista | 2007-11-16 19:04:14 +0100 (Fri, 16 Nov 2007) | 12 lines
Now in find, rfind, index, and rindex, you can use None as defaults,
as usual with slicing (both with str and unicode strings). This
fixes issue 1259.
For str only the stringobject.c file was modified. But for unicode,
I needed to repeat in the four functions a lot of code, so created
a new function that does part of the job for them (and placed it in
find.h, following a suggestion of Barry).
Also added tests for this behaviour.
........
r59021 | facundo.batista | 2007-11-16 19:41:24 +0100 (Fri, 16 Nov 2007) | 4 lines
Fix for stupid error (I need to remember to do a full 'make clean + make'
cycle before the tests...). Sorry.
........
r59022 | facundo.batista | 2007-11-16 20:16:15 +0100 (Fri, 16 Nov 2007) | 3 lines
Made _ParseTupleFinds only defined to unicodeobject.c
........
r59024 | raymond.hettinger | 2007-11-17 02:51:22 +0100 (Sat, 17 Nov 2007) | 1 line
Fix signature in example
........
r59033 | brett.cannon | 2007-11-17 08:07:29 +0100 (Sat, 17 Nov 2007) | 5 lines
Remove a confusing sentence about pth files and which directories are searched
for them.
Closes issue #1431. Thanks Giambattista Bloisi for the help.
........
r59039 | nick.coghlan | 2007-11-18 12:56:28 +0100 (Sun, 18 Nov 2007) | 1 line
Patch #1739468: Directories and zipfiles containing __main__.py are now executable
........
2007-11-18 15:35:23 -04:00
|
|
|
directory containing the :file:`.pth` file. See the documentation of
|
Merge the trunk changes in. Breaks socket.ssl for now.
Merged revisions 57392-57619 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r57395 | georg.brandl | 2007-08-24 19:23:23 +0200 (Fri, 24 Aug 2007) | 2 lines
Bug #1011: fix rfc822.Message.getheader docs.
........
r57397 | georg.brandl | 2007-08-24 19:38:49 +0200 (Fri, 24 Aug 2007) | 2 lines
Patch #1006: port test_winreg to unittest.
........
r57398 | georg.brandl | 2007-08-24 19:46:54 +0200 (Fri, 24 Aug 2007) | 2 lines
Fix #1012: wrong URL to :mod:`site` in install/index.rst.
........
r57399 | georg.brandl | 2007-08-24 20:07:52 +0200 (Fri, 24 Aug 2007) | 2 lines
Patch #1008: port test_signal to unittest.
........
r57400 | georg.brandl | 2007-08-24 20:22:54 +0200 (Fri, 24 Aug 2007) | 2 lines
Port test_frozen to unittest.
........
r57401 | georg.brandl | 2007-08-24 20:27:43 +0200 (Fri, 24 Aug 2007) | 2 lines
Document new utility functions in test_support.
........
r57402 | georg.brandl | 2007-08-24 20:30:06 +0200 (Fri, 24 Aug 2007) | 2 lines
Remove test_rgbimg output file, there is no test_rgbimg.py.
........
r57403 | georg.brandl | 2007-08-24 20:35:27 +0200 (Fri, 24 Aug 2007) | 2 lines
Remove output file for test_ossaudiodev, also properly close the dsp object.
........
r57404 | georg.brandl | 2007-08-24 20:46:27 +0200 (Fri, 24 Aug 2007) | 2 lines
Convert test_linuxaudiodev to unittest. Fix a wrong finally clause in test_ossaudiodev.
........
r57406 | collin.winter | 2007-08-24 21:13:58 +0200 (Fri, 24 Aug 2007) | 1 line
Convert test_pkg to use unittest.
........
r57408 | georg.brandl | 2007-08-24 21:22:34 +0200 (Fri, 24 Aug 2007) | 2 lines
Catch the correct errors.
........
r57409 | georg.brandl | 2007-08-24 21:33:53 +0200 (Fri, 24 Aug 2007) | 2 lines
Port test_class to unittest. Patch #1671298.
........
r57415 | collin.winter | 2007-08-24 23:09:42 +0200 (Fri, 24 Aug 2007) | 1 line
Make test_structmembers pass when run with regrtests's -R flag.
........
r57455 | nick.coghlan | 2007-08-25 06:32:07 +0200 (Sat, 25 Aug 2007) | 1 line
Revert misguided attempt at fixing incompatibility between -m and -i switches (better fix coming soon)
........
r57456 | nick.coghlan | 2007-08-25 06:35:54 +0200 (Sat, 25 Aug 2007) | 1 line
Revert compile.c changes that shouldn't have been included in previous checkin
........
r57461 | nick.coghlan | 2007-08-25 12:50:41 +0200 (Sat, 25 Aug 2007) | 1 line
Fix bug 1764407 - the -i switch now does the right thing when using the -m switch
........
r57464 | guido.van.rossum | 2007-08-25 17:08:43 +0200 (Sat, 25 Aug 2007) | 4 lines
Server-side SSL and certificate validation, by Bill Janssen.
While cleaning up Bill's C style, I may have cleaned up some code
he didn't touch as well (in _ssl.c).
........
r57465 | neal.norwitz | 2007-08-25 18:41:36 +0200 (Sat, 25 Aug 2007) | 3 lines
Try to get this to build with Visual Studio by moving all the variable
declarations to the beginning of a scope.
........
r57466 | neal.norwitz | 2007-08-25 18:54:38 +0200 (Sat, 25 Aug 2007) | 1 line
Fix test so it is skipped properly if there is no SSL support.
........
r57467 | neal.norwitz | 2007-08-25 18:58:09 +0200 (Sat, 25 Aug 2007) | 2 lines
Fix a few more variables to try to get this to compile with Visual Studio.
........
r57473 | neal.norwitz | 2007-08-25 19:25:17 +0200 (Sat, 25 Aug 2007) | 1 line
Try to get this test to pass for systems that do not have SO_REUSEPORT
........
r57482 | gregory.p.smith | 2007-08-26 02:26:00 +0200 (Sun, 26 Aug 2007) | 7 lines
keep setup.py from listing unneeded hash modules (_md5, _sha*) as
missing when they were not built because _hashlib with openssl provided
their functionality instead.
don't build bsddb185 if bsddb was built.
........
r57483 | neal.norwitz | 2007-08-26 03:08:16 +0200 (Sun, 26 Aug 2007) | 1 line
Fix typo in docstring (missing c in reacquire)
........
r57484 | neal.norwitz | 2007-08-26 03:42:03 +0200 (Sun, 26 Aug 2007) | 2 lines
Spell check (also americanify behaviour, it's almost 3 times as common)
........
r57503 | neal.norwitz | 2007-08-26 08:29:57 +0200 (Sun, 26 Aug 2007) | 4 lines
Reap children before the test starts so hopefully SocketServer
won't find any old children left around which causes an exception
in collect_children() and the test to fail.
........
r57510 | neal.norwitz | 2007-08-26 20:50:39 +0200 (Sun, 26 Aug 2007) | 1 line
Fail gracefully if the cert files cannot be created
........
r57513 | guido.van.rossum | 2007-08-26 21:35:09 +0200 (Sun, 26 Aug 2007) | 4 lines
Bill Janssen wrote:
Here's a patch which makes test_ssl a better player in the buildbots
environment. I deep-ended on "try-except-else" clauses.
........
r57518 | neal.norwitz | 2007-08-26 23:40:16 +0200 (Sun, 26 Aug 2007) | 1 line
Get the test passing by commenting out some writes (should they be removed?)
........
r57522 | neal.norwitz | 2007-08-27 00:16:23 +0200 (Mon, 27 Aug 2007) | 3 lines
Catch IOError for when the device file doesn't exist or the user doesn't have
permission to write to the device.
........
r57524 | neal.norwitz | 2007-08-27 00:20:03 +0200 (Mon, 27 Aug 2007) | 5 lines
Another patch from Bill Janssen that:
1) Fixes the bug that two class names are initial-lower-case.
2) Replaces the poll waiting for the server to become ready with
a threading.Event signal.
........
r57536 | neal.norwitz | 2007-08-27 02:58:33 +0200 (Mon, 27 Aug 2007) | 1 line
Stop using string.join (from the module) to ease upgrade to py3k
........
r57537 | neal.norwitz | 2007-08-27 03:03:18 +0200 (Mon, 27 Aug 2007) | 1 line
Make a utility function for handling (printing) an error
........
r57538 | neal.norwitz | 2007-08-27 03:15:33 +0200 (Mon, 27 Aug 2007) | 4 lines
If we can't create a certificate, print a warning, but don't fail the test.
Modified patch from what Bill Janssen sent on python-3000.
........
r57539 | facundo.batista | 2007-08-27 03:15:34 +0200 (Mon, 27 Aug 2007) | 7 lines
Ignore test failures caused by 'resource temporarily unavailable'
exceptions raised in the test server thread, since SimpleXMLRPCServer
does not gracefully handle them. Changed number of requests handled
by tests server thread to one (was 2) because no tests require more
than one request. [GSoC - Alan McIntyre]
........
r57561 | guido.van.rossum | 2007-08-27 19:19:42 +0200 (Mon, 27 Aug 2007) | 8 lines
> Regardless, building a fixed test certificate and checking it in sounds like
> the better option. Then the openssl command in the test code can be turned
> into a comment describing how the test data was pregenerated.
Here's a patch that does that.
Bill
........
r57568 | guido.van.rossum | 2007-08-27 20:42:23 +0200 (Mon, 27 Aug 2007) | 26 lines
> Some of the code sets the error string in this directly before
> returning NULL, and other pieces of the code call PySSL_SetError,
> which creates the error string. I think some of the places which set
> the string directly probably shouldn't; instead, they should call
> PySSL_SetError to cons up the error name directly from the err code.
> However, PySSL_SetError only works after the construction of an ssl
> object, which means it can't be used there... I'll take a longer look
> at it and see if there's a reasonable fix.
Here's a patch which addresses this. It also fixes the indentation in
PySSL_SetError, bringing it into line with PEP 7, fixes a compile warning
about one of the OpenSSL macros, and makes the namespace a bit more
consistent. I've tested it on FC 7 and OS X 10.4.
% ./python ./Lib/test/regrtest.py -R :1: -u all test_ssl
test_ssl
beginning 6 repetitions
123456
......
1 test OK.
[29244 refs]
%
[GvR: slightly edited to enforce 79-char line length, even if it required
violating the style guide.]
........
r57570 | guido.van.rossum | 2007-08-27 21:11:11 +0200 (Mon, 27 Aug 2007) | 2 lines
Patch 10124 by Bill Janssen, docs for the new ssl code.
........
r57574 | guido.van.rossum | 2007-08-27 22:51:00 +0200 (Mon, 27 Aug 2007) | 3 lines
Patch # 1739906 by Christian Heimes -- add reduce to functools (importing
it from __builtin__).
........
r57575 | guido.van.rossum | 2007-08-27 22:52:10 +0200 (Mon, 27 Aug 2007) | 2 lines
News about functools.reduce.
........
r57611 | georg.brandl | 2007-08-28 10:29:08 +0200 (Tue, 28 Aug 2007) | 2 lines
Document rev. 57574.
........
r57612 | sean.reifschneider | 2007-08-28 11:07:54 +0200 (Tue, 28 Aug 2007) | 2 lines
Adding basic imputil documentation.
........
r57614 | georg.brandl | 2007-08-28 12:48:18 +0200 (Tue, 28 Aug 2007) | 2 lines
Fix some glitches.
........
r57616 | lars.gustaebel | 2007-08-28 14:31:09 +0200 (Tue, 28 Aug 2007) | 5 lines
TarFile.__init__() no longer fails if no name argument is passed and
the fileobj argument has no usable name attribute (e.g. StringIO).
(will backport to 2.5)
........
r57619 | thomas.wouters | 2007-08-28 17:28:19 +0200 (Tue, 28 Aug 2007) | 22 lines
Improve extended slicing support in builtin types and classes. Specifically:
- Specialcase extended slices that amount to a shallow copy the same way as
is done for simple slices, in the tuple, string and unicode case.
- Specialcase step-1 extended slices to optimize the common case for all
involved types.
- For lists, allow extended slice assignment of differing lengths as long
as the step is 1. (Previously, 'l[:2:1] = []' failed even though
'l[:2] = []' and 'l[:2:None] = []' do not.)
- Implement extended slicing for buffer, array, structseq, mmap and
UserString.UserString.
- Implement slice-object support (but not non-step-1 slice assignment) for
UserString.MutableString.
- Add tests for all new functionality.
........
2007-08-28 18:37:11 -03:00
|
|
|
the :mod:`site` module for more information.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
A slightly less convenient way is to edit the :file:`site.py` file in Python's
|
|
|
|
standard library, and modify ``sys.path``. :file:`site.py` is automatically
|
|
|
|
imported when the Python interpreter is executed, unless the :option:`-S` switch
|
|
|
|
is supplied to suppress this behaviour. So you could simply edit
|
2018-04-09 11:56:44 -03:00
|
|
|
:file:`site.py` and add two lines to it:
|
|
|
|
|
|
|
|
.. code-block:: python
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
import sys
|
|
|
|
sys.path.append('/www/python/')
|
|
|
|
|
|
|
|
However, if you reinstall the same major version of Python (perhaps when
|
|
|
|
upgrading from 2.2 to 2.2.2, for example) :file:`site.py` will be overwritten by
|
|
|
|
the stock version. You'd have to remember that it was modified and save a copy
|
|
|
|
before doing the installation.
|
|
|
|
|
|
|
|
There are two environment variables that can modify ``sys.path``.
|
|
|
|
:envvar:`PYTHONHOME` sets an alternate value for the prefix of the Python
|
|
|
|
installation. For example, if :envvar:`PYTHONHOME` is set to ``/www/python``,
|
|
|
|
the search path will be set to ``['', '/www/python/lib/pythonX.Y/',
|
|
|
|
'/www/python/lib/pythonX.Y/plat-linux2', ...]``.
|
|
|
|
|
|
|
|
The :envvar:`PYTHONPATH` variable can be set to a list of paths that will be
|
|
|
|
added to the beginning of ``sys.path``. For example, if :envvar:`PYTHONPATH` is
|
|
|
|
set to ``/www/python:/opt/py``, the search path will begin with
|
|
|
|
``['/www/python', '/opt/py']``. (Note that directories must exist in order to
|
|
|
|
be added to ``sys.path``; the :mod:`site` module removes paths that don't
|
|
|
|
exist.)
|
|
|
|
|
|
|
|
Finally, ``sys.path`` is just a regular Python list, so any Python application
|
|
|
|
can modify it by adding or removing entries.
|
|
|
|
|
|
|
|
|
|
|
|
.. _inst-config-files:
|
|
|
|
|
|
|
|
Distutils Configuration Files
|
|
|
|
=============================
|
|
|
|
|
|
|
|
As mentioned above, you can use Distutils configuration files to record personal
|
|
|
|
or site preferences for any Distutils options. That is, any option to any
|
|
|
|
command can be stored in one of two or three (depending on your platform)
|
|
|
|
configuration files, which will be consulted before the command-line is parsed.
|
|
|
|
This means that configuration files will override default values, and the
|
|
|
|
command-line will in turn override configuration files. Furthermore, if
|
|
|
|
multiple configuration files apply, values from "earlier" files are overridden
|
|
|
|
by "later" files.
|
|
|
|
|
|
|
|
|
|
|
|
.. _inst-config-filenames:
|
|
|
|
|
|
|
|
Location and names of config files
|
|
|
|
----------------------------------
|
|
|
|
|
|
|
|
The names and locations of the configuration files vary slightly across
|
|
|
|
platforms. On Unix and Mac OS X, the three configuration files (in the order
|
|
|
|
they are processed) are:
|
|
|
|
|
|
|
|
+--------------+----------------------------------------------------------+-------+
|
|
|
|
| Type of file | Location and filename | Notes |
|
|
|
|
+==============+==========================================================+=======+
|
|
|
|
| system | :file:`{prefix}/lib/python{ver}/distutils/distutils.cfg` | \(1) |
|
|
|
|
+--------------+----------------------------------------------------------+-------+
|
|
|
|
| personal | :file:`$HOME/.pydistutils.cfg` | \(2) |
|
|
|
|
+--------------+----------------------------------------------------------+-------+
|
|
|
|
| local | :file:`setup.cfg` | \(3) |
|
|
|
|
+--------------+----------------------------------------------------------+-------+
|
|
|
|
|
|
|
|
And on Windows, the configuration files are:
|
|
|
|
|
|
|
|
+--------------+-------------------------------------------------+-------+
|
|
|
|
| Type of file | Location and filename | Notes |
|
|
|
|
+==============+=================================================+=======+
|
|
|
|
| system | :file:`{prefix}\\Lib\\distutils\\distutils.cfg` | \(4) |
|
|
|
|
+--------------+-------------------------------------------------+-------+
|
|
|
|
| personal | :file:`%HOME%\\pydistutils.cfg` | \(5) |
|
|
|
|
+--------------+-------------------------------------------------+-------+
|
|
|
|
| local | :file:`setup.cfg` | \(3) |
|
|
|
|
+--------------+-------------------------------------------------+-------+
|
|
|
|
|
2009-10-27 20:12:01 -03:00
|
|
|
On all platforms, the "personal" file can be temporarily disabled by
|
|
|
|
passing the `--no-user-cfg` option.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
Notes:
|
|
|
|
|
|
|
|
(1)
|
|
|
|
Strictly speaking, the system-wide configuration file lives in the directory
|
|
|
|
where the Distutils are installed; under Python 1.6 and later on Unix, this is
|
|
|
|
as shown. For Python 1.5.2, the Distutils will normally be installed to
|
|
|
|
:file:`{prefix}/lib/python1.5/site-packages/distutils`, so the system
|
|
|
|
configuration file should be put there under Python 1.5.2.
|
|
|
|
|
|
|
|
(2)
|
|
|
|
On Unix, if the :envvar:`HOME` environment variable is not defined, the user's
|
|
|
|
home directory will be determined with the :func:`getpwuid` function from the
|
2009-08-21 11:22:45 -03:00
|
|
|
standard :mod:`pwd` module. This is done by the :func:`os.path.expanduser`
|
|
|
|
function used by Distutils.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
(3)
|
|
|
|
I.e., in the current directory (usually the location of the setup script).
|
|
|
|
|
|
|
|
(4)
|
|
|
|
(See also note (1).) Under Python 1.6 and later, Python's default "installation
|
|
|
|
prefix" is :file:`C:\\Python`, so the system configuration file is normally
|
|
|
|
:file:`C:\\Python\\Lib\\distutils\\distutils.cfg`. Under Python 1.5.2, the
|
|
|
|
default prefix was :file:`C:\\Program Files\\Python`, and the Distutils were not
|
|
|
|
part of the standard library---so the system configuration file would be
|
|
|
|
:file:`C:\\Program Files\\Python\\distutils\\distutils.cfg` in a standard Python
|
|
|
|
1.5.2 installation under Windows.
|
|
|
|
|
|
|
|
(5)
|
2009-08-21 11:22:45 -03:00
|
|
|
On Windows, if the :envvar:`HOME` environment variable is not defined,
|
|
|
|
:envvar:`USERPROFILE` then :envvar:`HOMEDRIVE` and :envvar:`HOMEPATH` will
|
|
|
|
be tried. This is done by the :func:`os.path.expanduser` function used
|
|
|
|
by Distutils.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. _inst-config-syntax:
|
|
|
|
|
|
|
|
Syntax of config files
|
|
|
|
----------------------
|
|
|
|
|
|
|
|
The Distutils configuration files all have the same syntax. The config files
|
|
|
|
are grouped into sections. There is one section for each Distutils command,
|
|
|
|
plus a ``global`` section for global options that affect every command. Each
|
|
|
|
section consists of one option per line, specified as ``option=value``.
|
|
|
|
|
|
|
|
For example, the following is a complete config file that just forces all
|
2018-04-09 11:56:44 -03:00
|
|
|
commands to run quietly by default:
|
|
|
|
|
|
|
|
.. code-block:: ini
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
[global]
|
|
|
|
verbose=0
|
|
|
|
|
|
|
|
If this is installed as the system config file, it will affect all processing of
|
|
|
|
any Python module distribution by any user on the current system. If it is
|
|
|
|
installed as your personal config file (on systems that support them), it will
|
|
|
|
affect only module distributions processed by you. And if it is used as the
|
|
|
|
:file:`setup.cfg` for a particular module distribution, it affects only that
|
|
|
|
distribution.
|
|
|
|
|
|
|
|
You could override the default "build base" directory and make the
|
|
|
|
:command:`build\*` commands always forcibly rebuild all files with the
|
2018-04-09 11:56:44 -03:00
|
|
|
following:
|
|
|
|
|
|
|
|
.. code-block:: ini
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
[build]
|
|
|
|
build-base=blib
|
|
|
|
force=1
|
|
|
|
|
|
|
|
which corresponds to the command-line arguments ::
|
|
|
|
|
|
|
|
python setup.py build --build-base=blib --force
|
|
|
|
|
|
|
|
except that including the :command:`build` command on the command-line means
|
|
|
|
that command will be run. Including a particular command in config files has no
|
|
|
|
such implication; it only means that if the command is run, the options in the
|
|
|
|
config file will apply. (Or if other commands that derive values from it are
|
|
|
|
run, they will use the values in the config file.)
|
|
|
|
|
|
|
|
You can find out the complete list of options for any command using the
|
2016-04-16 01:59:38 -03:00
|
|
|
:option:`!--help` option, e.g.::
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
python setup.py build --help
|
|
|
|
|
|
|
|
and you can find out the complete list of global options by using
|
2016-04-16 01:59:38 -03:00
|
|
|
:option:`!--help` without a command::
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
python setup.py --help
|
|
|
|
|
|
|
|
See also the "Reference" section of the "Distributing Python Modules" manual.
|
|
|
|
|
|
|
|
|
|
|
|
.. _inst-building-ext:
|
|
|
|
|
|
|
|
Building Extensions: Tips and Tricks
|
|
|
|
====================================
|
|
|
|
|
|
|
|
Whenever possible, the Distutils try to use the configuration information made
|
|
|
|
available by the Python interpreter used to run the :file:`setup.py` script.
|
|
|
|
For example, the same compiler and linker flags used to compile Python will also
|
|
|
|
be used for compiling extensions. Usually this will work well, but in
|
|
|
|
complicated situations this might be inappropriate. This section discusses how
|
|
|
|
to override the usual Distutils behaviour.
|
|
|
|
|
|
|
|
|
|
|
|
.. _inst-tweak-flags:
|
|
|
|
|
|
|
|
Tweaking compiler/linker flags
|
|
|
|
------------------------------
|
|
|
|
|
|
|
|
Compiling a Python extension written in C or C++ will sometimes require
|
|
|
|
specifying custom flags for the compiler and linker in order to use a particular
|
|
|
|
library or produce a special kind of object code. This is especially true if the
|
|
|
|
extension hasn't been tested on your platform, or if you're trying to
|
|
|
|
cross-compile Python.
|
|
|
|
|
|
|
|
In the most general case, the extension author might have foreseen that
|
|
|
|
compiling the extensions would be complicated, and provided a :file:`Setup` file
|
|
|
|
for you to edit. This will likely only be done if the module distribution
|
|
|
|
contains many separate extension modules, or if they often require elaborate
|
|
|
|
sets of compiler flags in order to work.
|
|
|
|
|
|
|
|
A :file:`Setup` file, if present, is parsed in order to get a list of extensions
|
|
|
|
to build. Each line in a :file:`Setup` describes a single module. Lines have
|
|
|
|
the following structure::
|
|
|
|
|
|
|
|
module ... [sourcefile ...] [cpparg ...] [library ...]
|
|
|
|
|
|
|
|
|
|
|
|
Let's examine each of the fields in turn.
|
|
|
|
|
|
|
|
* *module* is the name of the extension module to be built, and should be a
|
|
|
|
valid Python identifier. You can't just change this in order to rename a module
|
|
|
|
(edits to the source code would also be needed), so this should be left alone.
|
|
|
|
|
|
|
|
* *sourcefile* is anything that's likely to be a source code file, at least
|
|
|
|
judging by the filename. Filenames ending in :file:`.c` are assumed to be
|
|
|
|
written in C, filenames ending in :file:`.C`, :file:`.cc`, and :file:`.c++` are
|
|
|
|
assumed to be C++, and filenames ending in :file:`.m` or :file:`.mm` are assumed
|
|
|
|
to be in Objective C.
|
|
|
|
|
|
|
|
* *cpparg* is an argument for the C preprocessor, and is anything starting with
|
2016-10-30 01:20:17 -03:00
|
|
|
:option:`!-I`, :option:`!-D`, :option:`!-U` or :option:`!-C`.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2016-10-30 01:20:17 -03:00
|
|
|
* *library* is anything ending in :file:`.a` or beginning with :option:`!-l` or
|
|
|
|
:option:`!-L`.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
If a particular platform requires a special library on your platform, you can
|
|
|
|
add it by editing the :file:`Setup` file and running ``python setup.py build``.
|
|
|
|
For example, if the module defined by the line ::
|
|
|
|
|
|
|
|
foo foomodule.c
|
|
|
|
|
|
|
|
must be linked with the math library :file:`libm.a` on your platform, simply add
|
2016-10-30 01:20:17 -03:00
|
|
|
:option:`!-lm` to the line::
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
foo foomodule.c -lm
|
|
|
|
|
|
|
|
Arbitrary switches intended for the compiler or the linker can be supplied with
|
2016-10-30 01:20:17 -03:00
|
|
|
the :option:`!-Xcompiler` *arg* and :option:`!-Xlinker` *arg* options::
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
foo foomodule.c -Xcompiler -o32 -Xlinker -shared -lm
|
|
|
|
|
2016-10-30 01:20:17 -03:00
|
|
|
The next option after :option:`!-Xcompiler` and :option:`!-Xlinker` will be
|
2007-08-15 11:28:22 -03:00
|
|
|
appended to the proper command line, so in the above example the compiler will
|
2016-10-30 01:20:17 -03:00
|
|
|
be passed the :option:`!-o32` option, and the linker will be passed
|
|
|
|
:option:`!-shared`. If a compiler option requires an argument, you'll have to
|
|
|
|
supply multiple :option:`!-Xcompiler` options; for example, to pass ``-x c++``
|
2007-08-15 11:28:22 -03:00
|
|
|
the :file:`Setup` file would have to contain ``-Xcompiler -x -Xcompiler c++``.
|
|
|
|
|
|
|
|
Compiler flags can also be supplied through setting the :envvar:`CFLAGS`
|
|
|
|
environment variable. If set, the contents of :envvar:`CFLAGS` will be added to
|
|
|
|
the compiler flags specified in the :file:`Setup` file.
|
|
|
|
|
|
|
|
|
|
|
|
.. _inst-non-ms-compilers:
|
|
|
|
|
|
|
|
Using non-Microsoft compilers on Windows
|
|
|
|
----------------------------------------
|
|
|
|
|
|
|
|
.. sectionauthor:: Rene Liebscher <R.Liebscher@gmx.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61239 | andrew.kuchling | 2008-03-05 01:44:41 +0100 (Wed, 05 Mar 2008) | 1 line
Add more items; add fragmentary notes
........
r61240 | amaury.forgeotdarc | 2008-03-05 02:50:33 +0100 (Wed, 05 Mar 2008) | 13 lines
Issue#2238: some syntax errors from *args or **kwargs expressions
would give bogus error messages, because of untested exceptions::
>>> f(**g(1=2))
XXX undetected error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'int' object is not iterable
instead of the expected SyntaxError: keyword can't be an expression
Will backport.
........
r61241 | neal.norwitz | 2008-03-05 06:10:48 +0100 (Wed, 05 Mar 2008) | 3 lines
Remove the files/dirs after closing the DB so the tests work on Windows.
Patch from Trent Nelson. Also simplified removing a file by using test_support.
........
r61242 | neal.norwitz | 2008-03-05 06:14:18 +0100 (Wed, 05 Mar 2008) | 3 lines
Get this test to pass even when there is no sound card in the system.
Patch from Trent Nelson. (I can't test this.)
........
r61243 | neal.norwitz | 2008-03-05 06:20:44 +0100 (Wed, 05 Mar 2008) | 3 lines
Catch OSError when trying to remove a file in case removal fails. This
should prevent a failure in tearDown masking any real test failure.
........
r61244 | neal.norwitz | 2008-03-05 06:38:06 +0100 (Wed, 05 Mar 2008) | 5 lines
Make the timeout longer to give slow machines a chance to pass the test
before timing out. This doesn't change the duration of the test under
normal circumstances. This is targetted at fixing the spurious failures
on the FreeBSD buildbot primarily.
........
r61245 | neal.norwitz | 2008-03-05 06:49:03 +0100 (Wed, 05 Mar 2008) | 1 line
Tabs -> spaces
........
r61246 | neal.norwitz | 2008-03-05 06:50:20 +0100 (Wed, 05 Mar 2008) | 1 line
Use -u urlfetch to run more tests
........
r61247 | neal.norwitz | 2008-03-05 06:51:20 +0100 (Wed, 05 Mar 2008) | 1 line
test_smtplib sometimes reports leaks too, suppress it
........
r61248 | jeffrey.yasskin | 2008-03-05 07:19:56 +0100 (Wed, 05 Mar 2008) | 5 lines
Fix test_socketserver on Windows after r61099 added several signal.alarm()
calls (which don't exist on non-Unix platforms).
Thanks to Trent Nelson for the report and patch.
........
r61249 | georg.brandl | 2008-03-05 08:10:35 +0100 (Wed, 05 Mar 2008) | 2 lines
Fix some rst.
........
r61252 | thomas.heller | 2008-03-05 15:53:39 +0100 (Wed, 05 Mar 2008) | 2 lines
News entry for yesterdays commit.
........
r61253 | thomas.heller | 2008-03-05 16:34:29 +0100 (Wed, 05 Mar 2008) | 3 lines
Issue 1872: Changed the struct module typecode from 't' to '?', for
compatibility with PEP3118.
........
r61254 | skip.montanaro | 2008-03-05 17:41:09 +0100 (Wed, 05 Mar 2008) | 4 lines
Elaborate on the role of the altinstall target when installing multiple
versions.
........
r61255 | georg.brandl | 2008-03-05 20:31:44 +0100 (Wed, 05 Mar 2008) | 2 lines
#2239: PYTHONPATH delimiter is os.pathsep.
........
r61256 | raymond.hettinger | 2008-03-05 21:59:58 +0100 (Wed, 05 Mar 2008) | 1 line
C implementation of itertools.permutations().
........
r61257 | raymond.hettinger | 2008-03-05 22:04:32 +0100 (Wed, 05 Mar 2008) | 1 line
Small code cleanup.
........
r61260 | martin.v.loewis | 2008-03-05 23:24:31 +0100 (Wed, 05 Mar 2008) | 2 lines
cd PCbuild only after deleting all pyc files.
........
r61261 | raymond.hettinger | 2008-03-06 02:15:52 +0100 (Thu, 06 Mar 2008) | 1 line
Add examples.
........
r61262 | andrew.kuchling | 2008-03-06 02:36:27 +0100 (Thu, 06 Mar 2008) | 1 line
Add two items
........
r61263 | georg.brandl | 2008-03-06 07:47:18 +0100 (Thu, 06 Mar 2008) | 2 lines
#1725737: ignore other VC directories other than CVS and SVN's too.
........
r61264 | martin.v.loewis | 2008-03-06 07:55:22 +0100 (Thu, 06 Mar 2008) | 4 lines
Patch #2232: os.tmpfile might fail on Windows if the user has no
permission to create files in the root directory.
Will backport to 2.5.
........
r61269 | georg.brandl | 2008-03-06 08:19:15 +0100 (Thu, 06 Mar 2008) | 2 lines
Expand on re.split behavior with captured expressions.
........
r61270 | georg.brandl | 2008-03-06 08:22:09 +0100 (Thu, 06 Mar 2008) | 2 lines
Little clarification of assignments.
........
r61271 | georg.brandl | 2008-03-06 08:31:34 +0100 (Thu, 06 Mar 2008) | 2 lines
Add isinstance/issubclass to tutorial.
........
r61272 | georg.brandl | 2008-03-06 08:34:52 +0100 (Thu, 06 Mar 2008) | 2 lines
Add missing NEWS entry for r61263.
........
r61273 | georg.brandl | 2008-03-06 08:41:16 +0100 (Thu, 06 Mar 2008) | 2 lines
#2225: return nonzero status code from py_compile if not all files could be compiled.
........
r61274 | georg.brandl | 2008-03-06 08:43:02 +0100 (Thu, 06 Mar 2008) | 2 lines
#2220: handle matching failure more gracefully.
........
r61275 | georg.brandl | 2008-03-06 08:45:52 +0100 (Thu, 06 Mar 2008) | 2 lines
Bug #2220: handle rlcompleter attribute match failure more gracefully.
........
r61278 | martin.v.loewis | 2008-03-06 14:49:47 +0100 (Thu, 06 Mar 2008) | 1 line
Rely on x64 platform configuration when building _bsddb on AMD64.
........
r61279 | martin.v.loewis | 2008-03-06 14:50:28 +0100 (Thu, 06 Mar 2008) | 1 line
Update db-4.4.20 build procedure.
........
r61285 | raymond.hettinger | 2008-03-06 21:52:01 +0100 (Thu, 06 Mar 2008) | 1 line
More tests.
........
r61286 | raymond.hettinger | 2008-03-06 23:51:36 +0100 (Thu, 06 Mar 2008) | 1 line
Issue 2246: itertools grouper object did not participate in GC (should be backported).
........
r61288 | raymond.hettinger | 2008-03-07 02:33:20 +0100 (Fri, 07 Mar 2008) | 1 line
Tweak recipes and tests
........
r61289 | jeffrey.yasskin | 2008-03-07 07:22:15 +0100 (Fri, 07 Mar 2008) | 5 lines
Progress on issue #1193577 by adding a polling .shutdown() method to
SocketServers. The core of the patch was written by Pedro Werneck, but any bugs
are mine. I've also rearranged the code for timeouts in order to avoid
interfering with the shutdown poll.
........
r61290 | nick.coghlan | 2008-03-07 15:13:28 +0100 (Fri, 07 Mar 2008) | 1 line
Speed up with statements by storing the __exit__ method on the stack instead of in a temp variable (bumps the magic number for pyc files)
........
r61298 | andrew.kuchling | 2008-03-07 22:09:23 +0100 (Fri, 07 Mar 2008) | 1 line
Grammar fix
........
r61303 | georg.brandl | 2008-03-08 10:54:06 +0100 (Sat, 08 Mar 2008) | 2 lines
#2253: fix continue vs. finally docs.
........
r61304 | marc-andre.lemburg | 2008-03-08 11:01:43 +0100 (Sat, 08 Mar 2008) | 3 lines
Add new name for Mandrake: Mandriva.
........
r61305 | georg.brandl | 2008-03-08 11:05:24 +0100 (Sat, 08 Mar 2008) | 2 lines
#1533486: fix types in refcount intro.
........
r61312 | facundo.batista | 2008-03-08 17:50:27 +0100 (Sat, 08 Mar 2008) | 5 lines
Issue 1106316. post_mortem()'s parameter, traceback, is now
optional: it defaults to the traceback of the exception that is currently
being handled.
........
r61313 | jeffrey.yasskin | 2008-03-08 19:26:54 +0100 (Sat, 08 Mar 2008) | 2 lines
Add tests for with and finally performance to pybench.
........
r61314 | jeffrey.yasskin | 2008-03-08 21:08:21 +0100 (Sat, 08 Mar 2008) | 2 lines
Fix pybench for pythons < 2.6, tested back to 2.3.
........
r61317 | jeffrey.yasskin | 2008-03-08 22:35:15 +0100 (Sat, 08 Mar 2008) | 3 lines
Well that was dumb. platform.python_implementation returns a function, not a
string.
........
r61329 | georg.brandl | 2008-03-09 16:11:39 +0100 (Sun, 09 Mar 2008) | 2 lines
#2249: document assertTrue and assertFalse.
........
r61332 | neal.norwitz | 2008-03-09 20:03:42 +0100 (Sun, 09 Mar 2008) | 4 lines
Introduce a lock to fix a race condition which caused an exception in the test.
Some buildbots were consistently failing (e.g., amd64).
Also remove a couple of semi-colons.
........
r61344 | raymond.hettinger | 2008-03-11 01:19:07 +0100 (Tue, 11 Mar 2008) | 1 line
Add recipe to docs.
........
r61350 | guido.van.rossum | 2008-03-11 22:18:06 +0100 (Tue, 11 Mar 2008) | 3 lines
Fix the overflows in expandtabs(). "This time for sure!"
(Exploit at request.)
........
r61351 | raymond.hettinger | 2008-03-11 22:37:46 +0100 (Tue, 11 Mar 2008) | 1 line
Improve docs for itemgetter(). Show that it works with slices.
........
r61363 | georg.brandl | 2008-03-13 08:15:56 +0100 (Thu, 13 Mar 2008) | 2 lines
#2265: fix example.
........
r61364 | georg.brandl | 2008-03-13 08:17:14 +0100 (Thu, 13 Mar 2008) | 2 lines
#2270: fix typo.
........
r61365 | georg.brandl | 2008-03-13 08:21:41 +0100 (Thu, 13 Mar 2008) | 2 lines
#1720705: add docs about import/threading interaction, wording by Nick.
........
r61366 | andrew.kuchling | 2008-03-13 12:07:35 +0100 (Thu, 13 Mar 2008) | 1 line
Add class decorators
........
r61367 | raymond.hettinger | 2008-03-13 17:43:17 +0100 (Thu, 13 Mar 2008) | 1 line
Add 2-to-3 support for the itertools moved to builtins or renamed.
........
r61368 | raymond.hettinger | 2008-03-13 17:43:59 +0100 (Thu, 13 Mar 2008) | 1 line
Consistent tense.
........
r61369 | raymond.hettinger | 2008-03-13 20:03:51 +0100 (Thu, 13 Mar 2008) | 1 line
Issue 2274: Add heapq.heappushpop().
........
r61370 | raymond.hettinger | 2008-03-13 20:33:34 +0100 (Thu, 13 Mar 2008) | 1 line
Simplify the nlargest() code using heappushpop().
........
r61371 | brett.cannon | 2008-03-13 21:27:00 +0100 (Thu, 13 Mar 2008) | 4 lines
Move test_thread over to unittest. Commits GHOP 237.
Thanks Benjamin Peterson for the patch.
........
r61372 | brett.cannon | 2008-03-13 21:33:10 +0100 (Thu, 13 Mar 2008) | 4 lines
Move test_tokenize to doctest.
Done as GHOP 238 by Josip Dzolonga.
........
r61373 | brett.cannon | 2008-03-13 21:47:41 +0100 (Thu, 13 Mar 2008) | 4 lines
Convert test_contains, test_crypt, and test_select to unittest.
Patch from GHOP 294 by David Marek.
........
r61374 | brett.cannon | 2008-03-13 22:02:16 +0100 (Thu, 13 Mar 2008) | 4 lines
Move test_gdbm to use unittest.
Closes issue #1960. Thanks Giampaolo Rodola.
........
r61375 | brett.cannon | 2008-03-13 22:09:28 +0100 (Thu, 13 Mar 2008) | 4 lines
Convert test_fcntl to unittest.
Closes issue #2055. Thanks Giampaolo Rodola.
........
r61376 | raymond.hettinger | 2008-03-14 06:03:44 +0100 (Fri, 14 Mar 2008) | 1 line
Leave heapreplace() unchanged.
........
r61378 | martin.v.loewis | 2008-03-14 14:56:09 +0100 (Fri, 14 Mar 2008) | 2 lines
Patch #2284: add -x64 option to rt.bat.
........
r61379 | martin.v.loewis | 2008-03-14 14:57:59 +0100 (Fri, 14 Mar 2008) | 2 lines
Use -x64 flag.
........
r61382 | brett.cannon | 2008-03-14 15:03:10 +0100 (Fri, 14 Mar 2008) | 2 lines
Remove a bad test.
........
r61383 | mark.dickinson | 2008-03-14 15:23:37 +0100 (Fri, 14 Mar 2008) | 9 lines
Issue 705836: Fix struct.pack(">f", 1e40) to behave consistently
across platforms: it should now raise OverflowError on all
platforms. (Previously it raised OverflowError only on
non IEEE 754 platforms.)
Also fix the (already existing) test for this behaviour
so that it actually raises TestFailed instead of just
referencing it.
........
r61387 | thomas.heller | 2008-03-14 22:06:21 +0100 (Fri, 14 Mar 2008) | 1 line
Remove unneeded initializer.
........
r61388 | martin.v.loewis | 2008-03-14 22:19:28 +0100 (Fri, 14 Mar 2008) | 2 lines
Run debug version, cd to PCbuild.
........
r61392 | georg.brandl | 2008-03-15 00:10:34 +0100 (Sat, 15 Mar 2008) | 2 lines
Remove obsolete paragraph. #2288.
........
r61395 | georg.brandl | 2008-03-15 01:20:19 +0100 (Sat, 15 Mar 2008) | 2 lines
Fix lots of broken links in the docs, found by Sphinx' external link checker.
........
r61396 | skip.montanaro | 2008-03-15 03:32:49 +0100 (Sat, 15 Mar 2008) | 1 line
note that fork and forkpty raise OSError on failure
........
r61402 | skip.montanaro | 2008-03-15 17:04:45 +0100 (Sat, 15 Mar 2008) | 1 line
add %f format to datetime - issue 1158
........
r61403 | skip.montanaro | 2008-03-15 17:07:11 +0100 (Sat, 15 Mar 2008) | 2 lines
.
........
2008-03-15 21:07:10 -03:00
|
|
|
Borland/CodeGear C++
|
|
|
|
^^^^^^^^^^^^^^^^^^^^
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61239 | andrew.kuchling | 2008-03-05 01:44:41 +0100 (Wed, 05 Mar 2008) | 1 line
Add more items; add fragmentary notes
........
r61240 | amaury.forgeotdarc | 2008-03-05 02:50:33 +0100 (Wed, 05 Mar 2008) | 13 lines
Issue#2238: some syntax errors from *args or **kwargs expressions
would give bogus error messages, because of untested exceptions::
>>> f(**g(1=2))
XXX undetected error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'int' object is not iterable
instead of the expected SyntaxError: keyword can't be an expression
Will backport.
........
r61241 | neal.norwitz | 2008-03-05 06:10:48 +0100 (Wed, 05 Mar 2008) | 3 lines
Remove the files/dirs after closing the DB so the tests work on Windows.
Patch from Trent Nelson. Also simplified removing a file by using test_support.
........
r61242 | neal.norwitz | 2008-03-05 06:14:18 +0100 (Wed, 05 Mar 2008) | 3 lines
Get this test to pass even when there is no sound card in the system.
Patch from Trent Nelson. (I can't test this.)
........
r61243 | neal.norwitz | 2008-03-05 06:20:44 +0100 (Wed, 05 Mar 2008) | 3 lines
Catch OSError when trying to remove a file in case removal fails. This
should prevent a failure in tearDown masking any real test failure.
........
r61244 | neal.norwitz | 2008-03-05 06:38:06 +0100 (Wed, 05 Mar 2008) | 5 lines
Make the timeout longer to give slow machines a chance to pass the test
before timing out. This doesn't change the duration of the test under
normal circumstances. This is targetted at fixing the spurious failures
on the FreeBSD buildbot primarily.
........
r61245 | neal.norwitz | 2008-03-05 06:49:03 +0100 (Wed, 05 Mar 2008) | 1 line
Tabs -> spaces
........
r61246 | neal.norwitz | 2008-03-05 06:50:20 +0100 (Wed, 05 Mar 2008) | 1 line
Use -u urlfetch to run more tests
........
r61247 | neal.norwitz | 2008-03-05 06:51:20 +0100 (Wed, 05 Mar 2008) | 1 line
test_smtplib sometimes reports leaks too, suppress it
........
r61248 | jeffrey.yasskin | 2008-03-05 07:19:56 +0100 (Wed, 05 Mar 2008) | 5 lines
Fix test_socketserver on Windows after r61099 added several signal.alarm()
calls (which don't exist on non-Unix platforms).
Thanks to Trent Nelson for the report and patch.
........
r61249 | georg.brandl | 2008-03-05 08:10:35 +0100 (Wed, 05 Mar 2008) | 2 lines
Fix some rst.
........
r61252 | thomas.heller | 2008-03-05 15:53:39 +0100 (Wed, 05 Mar 2008) | 2 lines
News entry for yesterdays commit.
........
r61253 | thomas.heller | 2008-03-05 16:34:29 +0100 (Wed, 05 Mar 2008) | 3 lines
Issue 1872: Changed the struct module typecode from 't' to '?', for
compatibility with PEP3118.
........
r61254 | skip.montanaro | 2008-03-05 17:41:09 +0100 (Wed, 05 Mar 2008) | 4 lines
Elaborate on the role of the altinstall target when installing multiple
versions.
........
r61255 | georg.brandl | 2008-03-05 20:31:44 +0100 (Wed, 05 Mar 2008) | 2 lines
#2239: PYTHONPATH delimiter is os.pathsep.
........
r61256 | raymond.hettinger | 2008-03-05 21:59:58 +0100 (Wed, 05 Mar 2008) | 1 line
C implementation of itertools.permutations().
........
r61257 | raymond.hettinger | 2008-03-05 22:04:32 +0100 (Wed, 05 Mar 2008) | 1 line
Small code cleanup.
........
r61260 | martin.v.loewis | 2008-03-05 23:24:31 +0100 (Wed, 05 Mar 2008) | 2 lines
cd PCbuild only after deleting all pyc files.
........
r61261 | raymond.hettinger | 2008-03-06 02:15:52 +0100 (Thu, 06 Mar 2008) | 1 line
Add examples.
........
r61262 | andrew.kuchling | 2008-03-06 02:36:27 +0100 (Thu, 06 Mar 2008) | 1 line
Add two items
........
r61263 | georg.brandl | 2008-03-06 07:47:18 +0100 (Thu, 06 Mar 2008) | 2 lines
#1725737: ignore other VC directories other than CVS and SVN's too.
........
r61264 | martin.v.loewis | 2008-03-06 07:55:22 +0100 (Thu, 06 Mar 2008) | 4 lines
Patch #2232: os.tmpfile might fail on Windows if the user has no
permission to create files in the root directory.
Will backport to 2.5.
........
r61269 | georg.brandl | 2008-03-06 08:19:15 +0100 (Thu, 06 Mar 2008) | 2 lines
Expand on re.split behavior with captured expressions.
........
r61270 | georg.brandl | 2008-03-06 08:22:09 +0100 (Thu, 06 Mar 2008) | 2 lines
Little clarification of assignments.
........
r61271 | georg.brandl | 2008-03-06 08:31:34 +0100 (Thu, 06 Mar 2008) | 2 lines
Add isinstance/issubclass to tutorial.
........
r61272 | georg.brandl | 2008-03-06 08:34:52 +0100 (Thu, 06 Mar 2008) | 2 lines
Add missing NEWS entry for r61263.
........
r61273 | georg.brandl | 2008-03-06 08:41:16 +0100 (Thu, 06 Mar 2008) | 2 lines
#2225: return nonzero status code from py_compile if not all files could be compiled.
........
r61274 | georg.brandl | 2008-03-06 08:43:02 +0100 (Thu, 06 Mar 2008) | 2 lines
#2220: handle matching failure more gracefully.
........
r61275 | georg.brandl | 2008-03-06 08:45:52 +0100 (Thu, 06 Mar 2008) | 2 lines
Bug #2220: handle rlcompleter attribute match failure more gracefully.
........
r61278 | martin.v.loewis | 2008-03-06 14:49:47 +0100 (Thu, 06 Mar 2008) | 1 line
Rely on x64 platform configuration when building _bsddb on AMD64.
........
r61279 | martin.v.loewis | 2008-03-06 14:50:28 +0100 (Thu, 06 Mar 2008) | 1 line
Update db-4.4.20 build procedure.
........
r61285 | raymond.hettinger | 2008-03-06 21:52:01 +0100 (Thu, 06 Mar 2008) | 1 line
More tests.
........
r61286 | raymond.hettinger | 2008-03-06 23:51:36 +0100 (Thu, 06 Mar 2008) | 1 line
Issue 2246: itertools grouper object did not participate in GC (should be backported).
........
r61288 | raymond.hettinger | 2008-03-07 02:33:20 +0100 (Fri, 07 Mar 2008) | 1 line
Tweak recipes and tests
........
r61289 | jeffrey.yasskin | 2008-03-07 07:22:15 +0100 (Fri, 07 Mar 2008) | 5 lines
Progress on issue #1193577 by adding a polling .shutdown() method to
SocketServers. The core of the patch was written by Pedro Werneck, but any bugs
are mine. I've also rearranged the code for timeouts in order to avoid
interfering with the shutdown poll.
........
r61290 | nick.coghlan | 2008-03-07 15:13:28 +0100 (Fri, 07 Mar 2008) | 1 line
Speed up with statements by storing the __exit__ method on the stack instead of in a temp variable (bumps the magic number for pyc files)
........
r61298 | andrew.kuchling | 2008-03-07 22:09:23 +0100 (Fri, 07 Mar 2008) | 1 line
Grammar fix
........
r61303 | georg.brandl | 2008-03-08 10:54:06 +0100 (Sat, 08 Mar 2008) | 2 lines
#2253: fix continue vs. finally docs.
........
r61304 | marc-andre.lemburg | 2008-03-08 11:01:43 +0100 (Sat, 08 Mar 2008) | 3 lines
Add new name for Mandrake: Mandriva.
........
r61305 | georg.brandl | 2008-03-08 11:05:24 +0100 (Sat, 08 Mar 2008) | 2 lines
#1533486: fix types in refcount intro.
........
r61312 | facundo.batista | 2008-03-08 17:50:27 +0100 (Sat, 08 Mar 2008) | 5 lines
Issue 1106316. post_mortem()'s parameter, traceback, is now
optional: it defaults to the traceback of the exception that is currently
being handled.
........
r61313 | jeffrey.yasskin | 2008-03-08 19:26:54 +0100 (Sat, 08 Mar 2008) | 2 lines
Add tests for with and finally performance to pybench.
........
r61314 | jeffrey.yasskin | 2008-03-08 21:08:21 +0100 (Sat, 08 Mar 2008) | 2 lines
Fix pybench for pythons < 2.6, tested back to 2.3.
........
r61317 | jeffrey.yasskin | 2008-03-08 22:35:15 +0100 (Sat, 08 Mar 2008) | 3 lines
Well that was dumb. platform.python_implementation returns a function, not a
string.
........
r61329 | georg.brandl | 2008-03-09 16:11:39 +0100 (Sun, 09 Mar 2008) | 2 lines
#2249: document assertTrue and assertFalse.
........
r61332 | neal.norwitz | 2008-03-09 20:03:42 +0100 (Sun, 09 Mar 2008) | 4 lines
Introduce a lock to fix a race condition which caused an exception in the test.
Some buildbots were consistently failing (e.g., amd64).
Also remove a couple of semi-colons.
........
r61344 | raymond.hettinger | 2008-03-11 01:19:07 +0100 (Tue, 11 Mar 2008) | 1 line
Add recipe to docs.
........
r61350 | guido.van.rossum | 2008-03-11 22:18:06 +0100 (Tue, 11 Mar 2008) | 3 lines
Fix the overflows in expandtabs(). "This time for sure!"
(Exploit at request.)
........
r61351 | raymond.hettinger | 2008-03-11 22:37:46 +0100 (Tue, 11 Mar 2008) | 1 line
Improve docs for itemgetter(). Show that it works with slices.
........
r61363 | georg.brandl | 2008-03-13 08:15:56 +0100 (Thu, 13 Mar 2008) | 2 lines
#2265: fix example.
........
r61364 | georg.brandl | 2008-03-13 08:17:14 +0100 (Thu, 13 Mar 2008) | 2 lines
#2270: fix typo.
........
r61365 | georg.brandl | 2008-03-13 08:21:41 +0100 (Thu, 13 Mar 2008) | 2 lines
#1720705: add docs about import/threading interaction, wording by Nick.
........
r61366 | andrew.kuchling | 2008-03-13 12:07:35 +0100 (Thu, 13 Mar 2008) | 1 line
Add class decorators
........
r61367 | raymond.hettinger | 2008-03-13 17:43:17 +0100 (Thu, 13 Mar 2008) | 1 line
Add 2-to-3 support for the itertools moved to builtins or renamed.
........
r61368 | raymond.hettinger | 2008-03-13 17:43:59 +0100 (Thu, 13 Mar 2008) | 1 line
Consistent tense.
........
r61369 | raymond.hettinger | 2008-03-13 20:03:51 +0100 (Thu, 13 Mar 2008) | 1 line
Issue 2274: Add heapq.heappushpop().
........
r61370 | raymond.hettinger | 2008-03-13 20:33:34 +0100 (Thu, 13 Mar 2008) | 1 line
Simplify the nlargest() code using heappushpop().
........
r61371 | brett.cannon | 2008-03-13 21:27:00 +0100 (Thu, 13 Mar 2008) | 4 lines
Move test_thread over to unittest. Commits GHOP 237.
Thanks Benjamin Peterson for the patch.
........
r61372 | brett.cannon | 2008-03-13 21:33:10 +0100 (Thu, 13 Mar 2008) | 4 lines
Move test_tokenize to doctest.
Done as GHOP 238 by Josip Dzolonga.
........
r61373 | brett.cannon | 2008-03-13 21:47:41 +0100 (Thu, 13 Mar 2008) | 4 lines
Convert test_contains, test_crypt, and test_select to unittest.
Patch from GHOP 294 by David Marek.
........
r61374 | brett.cannon | 2008-03-13 22:02:16 +0100 (Thu, 13 Mar 2008) | 4 lines
Move test_gdbm to use unittest.
Closes issue #1960. Thanks Giampaolo Rodola.
........
r61375 | brett.cannon | 2008-03-13 22:09:28 +0100 (Thu, 13 Mar 2008) | 4 lines
Convert test_fcntl to unittest.
Closes issue #2055. Thanks Giampaolo Rodola.
........
r61376 | raymond.hettinger | 2008-03-14 06:03:44 +0100 (Fri, 14 Mar 2008) | 1 line
Leave heapreplace() unchanged.
........
r61378 | martin.v.loewis | 2008-03-14 14:56:09 +0100 (Fri, 14 Mar 2008) | 2 lines
Patch #2284: add -x64 option to rt.bat.
........
r61379 | martin.v.loewis | 2008-03-14 14:57:59 +0100 (Fri, 14 Mar 2008) | 2 lines
Use -x64 flag.
........
r61382 | brett.cannon | 2008-03-14 15:03:10 +0100 (Fri, 14 Mar 2008) | 2 lines
Remove a bad test.
........
r61383 | mark.dickinson | 2008-03-14 15:23:37 +0100 (Fri, 14 Mar 2008) | 9 lines
Issue 705836: Fix struct.pack(">f", 1e40) to behave consistently
across platforms: it should now raise OverflowError on all
platforms. (Previously it raised OverflowError only on
non IEEE 754 platforms.)
Also fix the (already existing) test for this behaviour
so that it actually raises TestFailed instead of just
referencing it.
........
r61387 | thomas.heller | 2008-03-14 22:06:21 +0100 (Fri, 14 Mar 2008) | 1 line
Remove unneeded initializer.
........
r61388 | martin.v.loewis | 2008-03-14 22:19:28 +0100 (Fri, 14 Mar 2008) | 2 lines
Run debug version, cd to PCbuild.
........
r61392 | georg.brandl | 2008-03-15 00:10:34 +0100 (Sat, 15 Mar 2008) | 2 lines
Remove obsolete paragraph. #2288.
........
r61395 | georg.brandl | 2008-03-15 01:20:19 +0100 (Sat, 15 Mar 2008) | 2 lines
Fix lots of broken links in the docs, found by Sphinx' external link checker.
........
r61396 | skip.montanaro | 2008-03-15 03:32:49 +0100 (Sat, 15 Mar 2008) | 1 line
note that fork and forkpty raise OSError on failure
........
r61402 | skip.montanaro | 2008-03-15 17:04:45 +0100 (Sat, 15 Mar 2008) | 1 line
add %f format to datetime - issue 1158
........
r61403 | skip.montanaro | 2008-03-15 17:07:11 +0100 (Sat, 15 Mar 2008) | 2 lines
.
........
2008-03-15 21:07:10 -03:00
|
|
|
This subsection describes the necessary steps to use Distutils with the Borland
|
2007-08-15 11:28:22 -03:00
|
|
|
C++ compiler version 5.5. First you have to know that Borland's object file
|
|
|
|
format (OMF) is different from the format used by the Python version you can
|
|
|
|
download from the Python or ActiveState Web site. (Python is built with
|
|
|
|
Microsoft Visual C++, which uses COFF as the object file format.) For this
|
|
|
|
reason you have to convert Python's library :file:`python25.lib` into the
|
|
|
|
Borland format. You can do this as follows:
|
|
|
|
|
Merged revisions 59605-59624 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59606 | georg.brandl | 2007-12-29 11:57:00 +0100 (Sat, 29 Dec 2007) | 2 lines
Some cleanup in the docs.
........
r59611 | martin.v.loewis | 2007-12-29 19:49:21 +0100 (Sat, 29 Dec 2007) | 2 lines
Bug #1699: Define _BSD_SOURCE only on OpenBSD.
........
r59612 | raymond.hettinger | 2007-12-29 23:09:34 +0100 (Sat, 29 Dec 2007) | 1 line
Simpler documentation for itertools.tee(). Should be backported.
........
r59613 | raymond.hettinger | 2007-12-29 23:16:24 +0100 (Sat, 29 Dec 2007) | 1 line
Improve docs for itertools.groupby(). The use of xrange(0) to create a unique object is less obvious than object().
........
r59620 | christian.heimes | 2007-12-31 15:47:07 +0100 (Mon, 31 Dec 2007) | 3 lines
Added wininst-9.0.exe executable for VS 2008
Integrated bdist_wininst into PCBuild9 directory
........
r59621 | christian.heimes | 2007-12-31 15:51:18 +0100 (Mon, 31 Dec 2007) | 1 line
Moved PCbuild directory to PC/VS7.1
........
r59622 | christian.heimes | 2007-12-31 15:59:26 +0100 (Mon, 31 Dec 2007) | 1 line
Fix paths for build bot
........
r59623 | christian.heimes | 2007-12-31 16:02:41 +0100 (Mon, 31 Dec 2007) | 1 line
Fix paths for build bot, part 2
........
r59624 | christian.heimes | 2007-12-31 16:18:55 +0100 (Mon, 31 Dec 2007) | 1 line
Renamed PCBuild9 directory to PCBuild
........
2007-12-31 12:14:33 -04:00
|
|
|
.. Should we mention that users have to create cfg-files for the compiler?
|
|
|
|
.. see also http://community.borland.com/article/0,1410,21205,00.html
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
coff2omf python25.lib python25_bcpp.lib
|
|
|
|
|
|
|
|
The :file:`coff2omf` program comes with the Borland compiler. The file
|
|
|
|
:file:`python25.lib` is in the :file:`Libs` directory of your Python
|
|
|
|
installation. If your extension uses other libraries (zlib, ...) you have to
|
|
|
|
convert them too.
|
|
|
|
|
|
|
|
The converted files have to reside in the same directories as the normal
|
|
|
|
libraries.
|
|
|
|
|
|
|
|
How does Distutils manage to use these libraries with their changed names? If
|
|
|
|
the extension needs a library (eg. :file:`foo`) Distutils checks first if it
|
|
|
|
finds a library with suffix :file:`_bcpp` (eg. :file:`foo_bcpp.lib`) and then
|
|
|
|
uses this library. In the case it doesn't find such a special library it uses
|
|
|
|
the default name (:file:`foo.lib`.) [#]_
|
|
|
|
|
|
|
|
To let Distutils compile your extension with Borland C++ you now have to type::
|
|
|
|
|
|
|
|
python setup.py build --compiler=bcpp
|
|
|
|
|
|
|
|
If you want to use the Borland C++ compiler as the default, you could specify
|
|
|
|
this in your personal or system-wide configuration file for Distutils (see
|
|
|
|
section :ref:`inst-config-files`.)
|
|
|
|
|
|
|
|
|
|
|
|
.. seealso::
|
|
|
|
|
2016-05-07 04:49:07 -03:00
|
|
|
`C++Builder Compiler <https://www.embarcadero.com/products>`_
|
2007-08-15 11:28:22 -03:00
|
|
|
Information about the free C++ compiler from Borland, including links to the
|
|
|
|
download pages.
|
|
|
|
|
|
|
|
`Creating Python Extensions Using Borland's Free Compiler <http://www.cyberus.ca/~g_will/pyExtenDL.shtml>`_
|
|
|
|
Document describing how to use Borland's free command-line C++ compiler to build
|
|
|
|
Python.
|
|
|
|
|
|
|
|
|
|
|
|
GNU C / Cygwin / MinGW
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
This section describes the necessary steps to use Distutils with the GNU C/C++
|
|
|
|
compilers in their Cygwin and MinGW distributions. [#]_ For a Python interpreter
|
|
|
|
that was built with Cygwin, everything should work without any of these
|
|
|
|
following steps.
|
|
|
|
|
2010-12-15 18:06:35 -04:00
|
|
|
Not all extensions can be built with MinGW or Cygwin, but many can. Extensions
|
|
|
|
most likely to not work are those that use C++ or depend on Microsoft Visual C
|
|
|
|
extensions.
|
|
|
|
|
|
|
|
To let Distutils compile your extension with Cygwin you have to type::
|
|
|
|
|
|
|
|
python setup.py build --compiler=cygwin
|
|
|
|
|
|
|
|
and for Cygwin in no-cygwin mode [#]_ or for MinGW type::
|
|
|
|
|
|
|
|
python setup.py build --compiler=mingw32
|
|
|
|
|
|
|
|
If you want to use any of these options/compilers as default, you should
|
|
|
|
consider writing it in your personal or system-wide configuration file for
|
|
|
|
Distutils (see section :ref:`inst-config-files`.)
|
|
|
|
|
|
|
|
Older Versions of Python and MinGW
|
|
|
|
""""""""""""""""""""""""""""""""""
|
|
|
|
The following instructions only apply if you're using a version of Python
|
|
|
|
inferior to 2.4.1 with a MinGW inferior to 3.0.0 (with
|
|
|
|
binutils-2.13.90-20030111-1).
|
|
|
|
|
|
|
|
These compilers require some special libraries. This task is more complex than
|
2007-08-15 11:28:22 -03:00
|
|
|
for Borland's C++, because there is no program to convert the library. First
|
|
|
|
you have to create a list of symbols which the Python DLL exports. (You can find
|
Merged revisions 75365,75394,75402-75403,75418,75459,75484,75592-75596,75600,75602-75607,75610-75613,75616-75617,75623,75627,75640,75647,75696,75795 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r75365 | georg.brandl | 2009-10-11 22:16:16 +0200 (So, 11 Okt 2009) | 1 line
Fix broken links found by "make linkcheck". scipy.org seems to be done right now, so I could not verify links going there.
........
r75394 | georg.brandl | 2009-10-13 20:10:59 +0200 (Di, 13 Okt 2009) | 1 line
Fix markup.
........
r75402 | georg.brandl | 2009-10-14 17:51:48 +0200 (Mi, 14 Okt 2009) | 1 line
#7125: fix typo.
........
r75403 | georg.brandl | 2009-10-14 17:57:46 +0200 (Mi, 14 Okt 2009) | 1 line
#7126: os.environ changes *do* take effect in subprocesses started with os.system().
........
r75418 | georg.brandl | 2009-10-14 20:48:32 +0200 (Mi, 14 Okt 2009) | 1 line
#7116: str.join() takes an iterable.
........
r75459 | georg.brandl | 2009-10-17 10:57:43 +0200 (Sa, 17 Okt 2009) | 1 line
Fix refleaks in _ctypes PyCSimpleType_New, which fixes the refleak seen in test___all__.
........
r75484 | georg.brandl | 2009-10-18 09:58:12 +0200 (So, 18 Okt 2009) | 1 line
Fix missing word.
........
r75592 | georg.brandl | 2009-10-22 09:05:48 +0200 (Do, 22 Okt 2009) | 1 line
Fix punctuation.
........
r75593 | georg.brandl | 2009-10-22 09:06:49 +0200 (Do, 22 Okt 2009) | 1 line
Revert unintended change.
........
r75594 | georg.brandl | 2009-10-22 09:56:02 +0200 (Do, 22 Okt 2009) | 1 line
Fix markup.
........
r75595 | georg.brandl | 2009-10-22 09:56:56 +0200 (Do, 22 Okt 2009) | 1 line
Fix duplicate target.
........
r75596 | georg.brandl | 2009-10-22 10:05:04 +0200 (Do, 22 Okt 2009) | 1 line
Add a new directive marking up implementation details and start using it.
........
r75600 | georg.brandl | 2009-10-22 13:01:46 +0200 (Do, 22 Okt 2009) | 1 line
Make it more robust.
........
r75602 | georg.brandl | 2009-10-22 13:28:06 +0200 (Do, 22 Okt 2009) | 1 line
Document new directive.
........
r75603 | georg.brandl | 2009-10-22 13:28:23 +0200 (Do, 22 Okt 2009) | 1 line
Allow short form with text as argument.
........
r75604 | georg.brandl | 2009-10-22 13:36:50 +0200 (Do, 22 Okt 2009) | 1 line
Fix stylesheet for multi-paragraph impl-details.
........
r75605 | georg.brandl | 2009-10-22 13:48:10 +0200 (Do, 22 Okt 2009) | 1 line
Use "impl-detail" directive where applicable.
........
r75606 | georg.brandl | 2009-10-22 17:00:06 +0200 (Do, 22 Okt 2009) | 1 line
#6324: membership test tries iteration via __iter__.
........
r75607 | georg.brandl | 2009-10-22 17:04:09 +0200 (Do, 22 Okt 2009) | 1 line
#7088: document new functions in signal as Unix-only.
........
r75610 | georg.brandl | 2009-10-22 17:27:24 +0200 (Do, 22 Okt 2009) | 1 line
Reorder __slots__ fine print and add a clarification.
........
r75611 | georg.brandl | 2009-10-22 17:42:32 +0200 (Do, 22 Okt 2009) | 1 line
#7035: improve docs of the various <method>_errors() functions, and give them docstrings.
........
r75612 | georg.brandl | 2009-10-22 17:52:15 +0200 (Do, 22 Okt 2009) | 1 line
#7156: document curses as Unix-only.
........
r75613 | georg.brandl | 2009-10-22 17:54:35 +0200 (Do, 22 Okt 2009) | 1 line
#6977: getopt does not support optional option arguments.
........
r75616 | georg.brandl | 2009-10-22 18:17:05 +0200 (Do, 22 Okt 2009) | 1 line
Add proper references.
........
r75617 | georg.brandl | 2009-10-22 18:20:55 +0200 (Do, 22 Okt 2009) | 1 line
Make printout margin important.
........
r75623 | georg.brandl | 2009-10-23 10:14:44 +0200 (Fr, 23 Okt 2009) | 1 line
#7188: fix optionxform() docs.
........
r75627 | fred.drake | 2009-10-23 15:04:51 +0200 (Fr, 23 Okt 2009) | 2 lines
add further note about what's passed to optionxform
........
r75640 | neil.schemenauer | 2009-10-23 21:58:17 +0200 (Fr, 23 Okt 2009) | 2 lines
Improve some docstrings in the 'warnings' module.
........
r75647 | georg.brandl | 2009-10-24 12:04:19 +0200 (Sa, 24 Okt 2009) | 1 line
Fix markup.
........
r75696 | georg.brandl | 2009-10-25 21:25:43 +0100 (So, 25 Okt 2009) | 1 line
Fix a demo.
........
r75795 | georg.brandl | 2009-10-27 16:10:22 +0100 (Di, 27 Okt 2009) | 1 line
Fix a strange mis-edit.
........
2009-10-27 12:28:25 -03:00
|
|
|
a good program for this task at
|
2016-05-07 04:49:07 -03:00
|
|
|
https://sourceforge.net/projects/mingw/files/MinGW/Extension/pexports/).
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 59605-59624 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59606 | georg.brandl | 2007-12-29 11:57:00 +0100 (Sat, 29 Dec 2007) | 2 lines
Some cleanup in the docs.
........
r59611 | martin.v.loewis | 2007-12-29 19:49:21 +0100 (Sat, 29 Dec 2007) | 2 lines
Bug #1699: Define _BSD_SOURCE only on OpenBSD.
........
r59612 | raymond.hettinger | 2007-12-29 23:09:34 +0100 (Sat, 29 Dec 2007) | 1 line
Simpler documentation for itertools.tee(). Should be backported.
........
r59613 | raymond.hettinger | 2007-12-29 23:16:24 +0100 (Sat, 29 Dec 2007) | 1 line
Improve docs for itertools.groupby(). The use of xrange(0) to create a unique object is less obvious than object().
........
r59620 | christian.heimes | 2007-12-31 15:47:07 +0100 (Mon, 31 Dec 2007) | 3 lines
Added wininst-9.0.exe executable for VS 2008
Integrated bdist_wininst into PCBuild9 directory
........
r59621 | christian.heimes | 2007-12-31 15:51:18 +0100 (Mon, 31 Dec 2007) | 1 line
Moved PCbuild directory to PC/VS7.1
........
r59622 | christian.heimes | 2007-12-31 15:59:26 +0100 (Mon, 31 Dec 2007) | 1 line
Fix paths for build bot
........
r59623 | christian.heimes | 2007-12-31 16:02:41 +0100 (Mon, 31 Dec 2007) | 1 line
Fix paths for build bot, part 2
........
r59624 | christian.heimes | 2007-12-31 16:18:55 +0100 (Mon, 31 Dec 2007) | 1 line
Renamed PCBuild9 directory to PCBuild
........
2007-12-31 12:14:33 -04:00
|
|
|
.. I don't understand what the next line means. --amk
|
|
|
|
.. (inclusive the references on data structures.)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
pexports python25.dll >python25.def
|
|
|
|
|
|
|
|
The location of an installed :file:`python25.dll` will depend on the
|
|
|
|
installation options and the version and language of Windows. In a "just for
|
|
|
|
me" installation, it will appear in the root of the installation directory. In
|
|
|
|
a shared installation, it will be located in the system directory.
|
|
|
|
|
|
|
|
Then you can create from these information an import library for gcc. ::
|
|
|
|
|
|
|
|
/cygwin/bin/dlltool --dllname python25.dll --def python25.def --output-lib libpython25.a
|
|
|
|
|
|
|
|
The resulting library has to be placed in the same directory as
|
|
|
|
:file:`python25.lib`. (Should be the :file:`libs` directory under your Python
|
|
|
|
installation directory.)
|
|
|
|
|
|
|
|
If your extension uses other libraries (zlib,...) you might have to convert
|
|
|
|
them too. The converted files have to reside in the same directories as the
|
|
|
|
normal libraries do.
|
|
|
|
|
|
|
|
|
|
|
|
.. seealso::
|
|
|
|
|
2014-10-29 06:26:56 -03:00
|
|
|
`Building Python modules on MS Windows platform with MinGW <http://old.zope.org/Members/als/tips/win32_mingw_modules>`_
|
2007-08-15 11:28:22 -03:00
|
|
|
Information about building the required libraries for the MinGW environment.
|
|
|
|
|
|
|
|
|
|
|
|
.. rubric:: Footnotes
|
|
|
|
|
|
|
|
.. [#] This also means you could replace all existing COFF-libraries with OMF-libraries
|
|
|
|
of the same name.
|
|
|
|
|
2016-05-07 04:49:07 -03:00
|
|
|
.. [#] Check https://www.sourceware.org/cygwin/ and http://www.mingw.org/ for more
|
2007-08-15 11:28:22 -03:00
|
|
|
information
|
|
|
|
|
|
|
|
.. [#] Then you have no POSIX emulation available, but you also don't need
|
|
|
|
:file:`cygwin1.dll`.
|