Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Doc/install/index.rst

    r2 r391  
    88
    99:Author: Greg Ward
    10 :Release: |version|
    11 :Date: |today|
    1210
    1311.. TODO: Fill in XXX comments
     
    7371--install`` it if it's an RPM, etc.  You don't need to run Python or a setup
    7472script, you don't need to compile anything---you might not even need to read any
    75 instructions (although it's always a good idea to do so anyways).
     73instructions (although it's always a good idea to do so anyway).
    7674
    7775Of course, things will not always be that easy.  You might be interested in a
     
    9795distribution will contain a setup script :file:`setup.py`, and a file named
    9896:file:`README.txt` or possibly just :file:`README`, which should explain that
    99 building and installing the module distribution is a simple matter of running ::
     97building and installing the module distribution is a simple matter of running
     98one command from a terminal::
    10099
    101100   python setup.py install
     101
     102For Windows, this command should be run from a command prompt window
     103(:menuselection:`Start --> Accessories`)::
     104
     105   setup.py install
    102106
    103107If all these things are true, then you already know how to build and install the
     
    114118
    115119As described in section :ref:`inst-new-standard`, building and installing a module
    116 distribution using the Distutils is usually one simple command::
     120distribution using the Distutils is usually one simple command to run from a
     121terminal::
    117122
    118123   python setup.py install
    119 
    120 On Unix, you'd run this command from a shell prompt; on Windows, you have to
    121 open a command prompt window ("DOS box") and do it there; on Mac OS X, you open
    122 a :command:`Terminal` window to get a shell prompt.
    123124
    124125
     
    142143graphical user interface (such as WinZip) or a command-line tool (such as
    143144:program:`unzip` or :program:`pkunzip`) to unpack the archive.  Then, open a
    144 command prompt window ("DOS box"), and run::
     145command prompt window and run::
    145146
    146147   cd c:\Temp\foo-1.0
     
    189190:option:`--build-base` option. For example::
    190191
    191    python setup.py build --build-base=/tmp/pybuild/foo-1.0
     192   python setup.py build --build-base=/path/to/pybuild/foo-1.0
    192193
    193194(Or you could do this permanently with a directive in your system or personal
     
    235236is pure Python or contains extensions ("non-pure"):
    236237
     238.. tabularcolumns:: |l|l|l|l|
     239
    237240+-----------------+-----------------------------------------------------+--------------------------------------------------+-------+
    238241| Platform        | Standard installation location                      | Default value                                    | Notes |
     
    242245| Unix (non-pure) | :file:`{exec-prefix}/lib/python{X.Y}/site-packages` | :file:`/usr/local/lib/python{X.Y}/site-packages` | \(1)  |
    243246+-----------------+-----------------------------------------------------+--------------------------------------------------+-------+
    244 | Windows         | :file:`{prefix}`                                    | :file:`C:\\Python`                               | \(2)  |
     247| Windows         | :file:`{prefix}\\Lib\\site-packages`                | :file:`C:\\Python{XY}\\Lib\\site-packages`       | \(2)  |
    245248+-----------------+-----------------------------------------------------+--------------------------------------------------+-------+
    246249
     
    277280   '/usr'
    278281
     282A few other placeholders are used in this document: :file:`{X.Y}` stands for the
     283version of Python, for example ``2.7``; :file:`{distname}` will be replaced by
     284the name of the module distribution being installed.  Dots and capitalization
     285are important in the paths; for example, a value that uses ``python2.7`` on UNIX
     286will typically use ``Python27`` on Windows.
     287
    279288If you don't want to install modules to the standard location, or if you don't
    280289have permission to write there, then you need to read about alternate
     
    305314you.
    306315
    307 
    308 .. _inst-alt-install-prefix:
     316Note that the various alternate installation schemes are mutually exclusive: you
     317can pass ``--user``, or ``--home``, or ``--prefix`` and ``--exec-prefix``, or
     318``--install-base`` and ``--install-platbase``, but you can't mix from these
     319groups.
     320
     321
     322.. _inst-alt-install-user:
     323
     324Alternate installation: the user scheme
     325---------------------------------------
     326
     327This scheme is designed to be the most convenient solution for users that don't
     328have write permission to the global site-packages directory or don't want to
     329install into it.  It is enabled with a simple option::
     330
     331   python setup.py install --user
     332
     333Files will be installed into subdirectories of :data:`site.USER_BASE` (written
     334as :file:`{userbase}` hereafter).  This scheme installs pure Python modules and
     335extension modules in the same location (also known as :data:`site.USER_SITE`).
     336Here are the values for UNIX, including Mac OS X:
     337
     338=============== ===========================================================
     339Type of file    Installation directory
     340=============== ===========================================================
     341modules         :file:`{userbase}/lib/python{X.Y}/site-packages`
     342scripts         :file:`{userbase}/bin`
     343data            :file:`{userbase}`
     344C headers       :file:`{userbase}/include/python{X.Y}/{distname}`
     345=============== ===========================================================
     346
     347And here are the values used on Windows:
     348
     349=============== ===========================================================
     350Type of file    Installation directory
     351=============== ===========================================================
     352modules         :file:`{userbase}\\Python{XY}\\site-packages`
     353scripts         :file:`{userbase}\\Scripts`
     354data            :file:`{userbase}`
     355C headers       :file:`{userbase}\\Python{XY}\\Include\\{distname}`
     356=============== ===========================================================
     357
     358The advantage of using this scheme compared to the other ones described below is
     359that the user site-packages directory is under normal conditions always included
     360in :data:`sys.path` (see :mod:`site` for more information), which means that
     361there is no additional step to perform after running the :file:`setup.py` script
     362to finalize the installation.
     363
     364The :command:`build_ext` command also has a ``--user`` option to add
     365:file:`{userbase}/include` to the compiler search path for header files and
     366:file:`{userbase}/lib` to the compiler search path for libraries as well as to
     367the runtime search path for shared C libraries (rpath).
     368
     369
     370.. _inst-alt-install-home:
    309371
    310372Alternate installation: the home scheme
     
    315377"home" directory on Unix, since it's not unusual for a Unix user to make their
    316378home directory have a layout similar to :file:`/usr/` or :file:`/usr/local/`.
    317 This scheme can be used by anyone, regardless of the operating system their
    318 installing for.
     379This scheme can be used by anyone, regardless of the operating system they
     380are installing for.
    319381
    320382Installing a new module distribution is as simple as ::
     
    328390   python setup.py install --home=~
    329391
     392To make Python find the distributions installed with this scheme, you may have
     393to :ref:`modify Python's search path <inst-search-path>` or edit
     394:mod:`sitecustomize` (see :mod:`site`) to call :func:`site.addsitedir` or edit
     395:data:`sys.path`.
     396
    330397The :option:`--home` option defines the installation base directory.  Files are
    331398installed to the following directories under the installation base as follows:
    332399
    333 +------------------------------+---------------------------+-----------------------------+
    334 | Type of file                 | Installation Directory    | Override option             |
    335 +==============================+===========================+=============================+
    336 | pure module distribution     | :file:`{home}/lib/python` | :option:`--install-purelib` |
    337 +------------------------------+---------------------------+-----------------------------+
    338 | non-pure module distribution | :file:`{home}/lib/python` | :option:`--install-platlib` |
    339 +------------------------------+---------------------------+-----------------------------+
    340 | scripts                      | :file:`{home}/bin`        | :option:`--install-scripts` |
    341 +------------------------------+---------------------------+-----------------------------+
    342 | data                         | :file:`{home}/share`      | :option:`--install-data`    |
    343 +------------------------------+---------------------------+-----------------------------+
     400=============== ===========================================================
     401Type of file    Installation directory
     402=============== ===========================================================
     403modules         :file:`{home}/lib/python`
     404scripts         :file:`{home}/bin`
     405data            :file:`{home}`
     406C headers       :file:`{home}/include/python/{distname}`
     407=============== ===========================================================
     408
     409(Mentally replace slashes with backslashes if you're on Windows.)
    344410
    345411.. versionchanged:: 2.4
     
    347413
    348414
    349 .. _inst-alt-install-home:
     415.. _inst-alt-install-prefix-unix:
    350416
    351417Alternate installation: Unix (the prefix scheme)
     
    356422into the third-party module directory of a different Python installation (or
    357423something that looks like a different Python installation).  If this sounds a
    358 trifle unusual, it is---that's why the "home scheme" comes first.  However,
     424trifle unusual, it is---that's why the user and home schemes come before.  However,
    359425there are at least two known cases where the prefix scheme will be useful.
    360426
     
    384450:option:`--prefix`.  Files are installed as follows:
    385451
    386 +------------------------------+-----------------------------------------------------+-----------------------------+
    387 | Type of file                 | Installation Directory                              | Override option             |
    388 +==============================+=====================================================+=============================+
    389 | pure module distribution     | :file:`{prefix}/lib/python{X.Y}/site-packages`      | :option:`--install-purelib` |
    390 +------------------------------+-----------------------------------------------------+-----------------------------+
    391 | non-pure module distribution | :file:`{exec-prefix}/lib/python{X.Y}/site-packages` | :option:`--install-platlib` |
    392 +------------------------------+-----------------------------------------------------+-----------------------------+
    393 | scripts                      | :file:`{prefix}/bin`                                | :option:`--install-scripts` |
    394 +------------------------------+-----------------------------------------------------+-----------------------------+
    395 | data                         | :file:`{prefix}/share`                              | :option:`--install-data`    |
    396 +------------------------------+-----------------------------------------------------+-----------------------------+
     452================= ==========================================================
     453Type of file      Installation directory
     454================= ==========================================================
     455Python modules    :file:`{prefix}/lib/python{X.Y}/site-packages`
     456extension modules :file:`{exec-prefix}/lib/python{X.Y}/site-packages`
     457scripts           :file:`{prefix}/bin`
     458data              :file:`{prefix}`
     459C headers         :file:`{prefix}/include/python{X.Y}/{distname}`
     460================= ==========================================================
    397461
    398462There is no requirement that :option:`--prefix` or :option:`--exec-prefix`
     
    419483
    420484
    421 .. _inst-alt-install-windows:
     485.. _inst-alt-install-prefix-windows:
    422486
    423487Alternate installation: Windows (the prefix scheme)
     
    434498
    435499The installation base is defined by the :option:`--prefix` option; the
    436 :option:`--exec-prefix` option is not supported under Windows. Files are
    437 installed as follows:
    438 
    439 +------------------------------+---------------------------+-----------------------------+
    440 | Type of file                 | Installation Directory    | Override option             |
    441 +==============================+===========================+=============================+
    442 | pure module distribution     | :file:`{prefix}`          | :option:`--install-purelib` |
    443 +------------------------------+---------------------------+-----------------------------+
    444 | non-pure module distribution | :file:`{prefix}`          | :option:`--install-platlib` |
    445 +------------------------------+---------------------------+-----------------------------+
    446 | scripts                      | :file:`{prefix}\\Scripts` | :option:`--install-scripts` |
    447 +------------------------------+---------------------------+-----------------------------+
    448 | data                         | :file:`{prefix}\\Data`    | :option:`--install-data`    |
    449 +------------------------------+---------------------------+-----------------------------+
     500:option:`--exec-prefix` option is not supported under Windows, which means that
     501pure Python modules and extension modules are installed into the same location.
     502Files are installed as follows:
     503
     504=============== ==========================================================
     505Type of file    Installation directory
     506=============== ==========================================================
     507modules         :file:`{prefix}\\Lib\\site-packages`
     508scripts         :file:`{prefix}\\Scripts`
     509data            :file:`{prefix}`
     510C headers       :file:`{prefix}\\Include\\{distname}`
     511=============== ==========================================================
    450512
    451513
     
    461523case, you're creating a *custom installation scheme*.
    462524
    463 You probably noticed the column of "override options" in the tables describing
    464 the alternate installation schemes above.  Those options are how you define a
    465 custom installation scheme.  These override options can be relative, absolute,
     525To create a custom installation scheme, you start with one of the alternate
     526schemes and override some of the installation directories used for the various
     527types of files, using these options:
     528
     529====================== =======================
     530Type of file           Override option
     531====================== =======================
     532Python modules         ``--install-purelib``
     533extension modules      ``--install-platlib``
     534all modules            ``--install-lib``
     535scripts                ``--install-scripts``
     536data                   ``--install-data``
     537C headers              ``--install-headers``
     538====================== =======================
     539
     540These override options can be relative, absolute,
    466541or explicitly defined in terms of one of the installation base directories.
    467542(There are two installation base directories, and they are normally the same---
    468543they only differ when you use the Unix "prefix scheme" and supply different
    469 :option:`--prefix` and :option:`--exec-prefix` options.)
     544``--prefix`` and ``--exec-prefix`` options; using ``--install-lib`` will
     545override values computed or given for ``--install-purelib`` and
     546``--install-platlib``, and is recommended for schemes that don't make a
     547difference between Python and extension modules.)
    470548
    471549For example, say you're installing a module distribution to your home directory
     
    494572itself.  This is almost as easy as customizing the script installation directory
    495573---you just have to remember that there are two types of modules to worry about,
    496 pure modules and non-pure modules (i.e., modules from a non-pure distribution).
    497 For example::
    498 
    499    python setup.py install --install-purelib=Site --install-platlib=Site
    500 
    501 The specified installation directories are relative to :file:`{prefix}`.  Of
    502 course, you also have to ensure that these directories are in Python's module
    503 search path, such as by putting a :file:`.pth` file in :file:`{prefix}`.  See
    504 section :ref:`inst-search-path` to find out how to modify Python's search path.
     574Python and extension modules, which can conveniently be both controlled by one
     575option::
     576
     577   python setup.py install --install-lib=Site
     578
     579The specified installation directory is relative to :file:`{prefix}`.  Of
     580course, you also have to ensure that this directory is in Python's module
     581search path, such as by putting a :file:`.pth` file in a site directory (see
     582:mod:`site`).  See section :ref:`inst-search-path` to find out how to modify
     583Python's search path.
    505584
    506585If you want to define an entire installation scheme, you just have to supply all
     
    554633   python setup.py install --install-base=/tmp
    555634
    556 would install pure modules to :file:`{/tmp/python/lib}` in the first case, and
    557 to :file:`{/tmp/lib}` in the second case.  (For the second case, you probably
     635would install pure modules to :file:`/tmp/python/lib` in the first case, and
     636to :file:`/tmp/lib` in the second case.  (For the second case, you probably
    558637want to supply an installation base of :file:`/tmp/python`.)
    559638
     
    572651
    573652
    574 .. XXX I'm not sure where this section should go.
     653.. XXX Move this to Doc/using
    575654
    576655.. _inst-search-path:
     
    695774+--------------+-------------------------------------------------+-------+
    696775
     776On all platforms, the "personal" file can be temporarily disabled by
     777passing the `--no-user-cfg` option.
     778
    697779Notes:
    698780
     
    9301012^^^^^^^^^^^^^^^^^^^^^^
    9311013
    932 These instructions only apply if you're using a version of Python prior  to
    933 2.4.1 with a MinGW prior to 3.0.0 (with binutils-2.13.90-20030111-1).
    934 
    9351014This section describes the necessary steps to use Distutils with the GNU C/C++
    9361015compilers in their Cygwin and MinGW distributions. [#]_ For a Python interpreter
     
    9381017following steps.
    9391018
    940 These compilers require some special libraries. This task is more complex than
     1019Not all extensions can be built with MinGW or Cygwin, but many can.  Extensions
     1020most likely to not work are those that use C++ or depend on Microsoft Visual C
     1021extensions.
     1022
     1023To let Distutils compile your extension with Cygwin you have to type::
     1024
     1025   python setup.py build --compiler=cygwin
     1026
     1027and for Cygwin in no-cygwin mode [#]_ or for MinGW type::
     1028
     1029   python setup.py build --compiler=mingw32
     1030
     1031If you want to use any of these options/compilers as default, you should
     1032consider writing it in your personal or system-wide configuration file for
     1033Distutils (see section :ref:`inst-config-files`.)
     1034
     1035Older Versions of Python and MinGW
     1036""""""""""""""""""""""""""""""""""
     1037The following instructions only apply if you're using a version of Python
     1038inferior to 2.4.1 with a MinGW inferior to 3.0.0 (with
     1039binutils-2.13.90-20030111-1).
     1040
     1041These compilers require some special libraries.  This task is more complex than
    9411042for Borland's C++, because there is no program to convert the library.  First
    9421043you have to create a list of symbols which the Python DLL exports. (You can find
    9431044a good program for this task at
    944 http://www.emmestech.com/software/pexports-0.43/download_pexports.html).
     1045http://sourceforge.net/projects/mingw/files/MinGW/Extension/pexports/).
    9451046
    9461047.. I don't understand what the next line means. --amk
     
    9681069normal libraries do.
    9691070
    970 To let Distutils compile your extension with Cygwin you now have to type ::
    971 
    972    python setup.py build --compiler=cygwin
    973 
    974 and for Cygwin in no-cygwin mode [#]_ or for MinGW type::
    975 
    976    python setup.py build --compiler=mingw32
    977 
    978 If you want to use any of these options/compilers as default, you should
    979 consider to write it in your personal or system-wide configuration file for
    980 Distutils (see section :ref:`inst-config-files`.)
    981 
    9821071
    9831072.. seealso::
Note: See TracChangeset for help on using the changeset viewer.