blob: 8c65d9d591188bc38e3c1f0d3a4d666a2b92dbe0 [file] [log] [blame]
Georg Brandl116aa622007-08-15 14:28:22 +00001.. _built-dist:
2
3****************************
4Creating Built Distributions
5****************************
6
Nick Coghlandae12292019-05-14 22:04:30 +10007.. include:: ./_setuptools_disclaimer.rst
8
Georg Brandl116aa622007-08-15 14:28:22 +00009A "built distribution" is what you're probably used to thinking of either as a
10"binary package" or an "installer" (depending on your background). It's not
11necessarily binary, though, because it might contain only Python source code
12and/or byte-code; and we don't call it a package, because that word is already
13spoken for in Python. (And "installer" is a term specific to the world of
14mainstream desktop systems.)
15
16A built distribution is how you make life as easy as possible for installers of
17your module distribution: for users of RPM-based Linux systems, it's a binary
18RPM; for Windows users, it's an executable installer; for Debian-based Linux
19users, it's a Debian package; and so forth. Obviously, no one person will be
20able to create built distributions for every platform under the sun, so the
21Distutils are designed to enable module developers to concentrate on their
22specialty---writing code and creating source distributions---while an
23intermediary species called *packagers* springs up to turn source distributions
24into built distributions for as many platforms as there are packagers.
25
Andrés Delfino50924392018-06-18 01:34:30 -030026Of course, the module developer could be their own packager; or the packager could
Georg Brandl116aa622007-08-15 14:28:22 +000027be a volunteer "out there" somewhere who has access to a platform which the
28original developer does not; or it could be software periodically grabbing new
29source distributions and turning them into built distributions for as many
30platforms as the software has access to. Regardless of who they are, a packager
31uses the setup script and the :command:`bdist` command family to generate built
32distributions.
33
34As a simple example, if I run the following command in the Distutils source
35tree::
36
37 python setup.py bdist
38
39then the Distutils builds my module distribution (the Distutils itself in this
40case), does a "fake" installation (also in the :file:`build` directory), and
41creates the default type of built distribution for my platform. The default
42format for built distributions is a "dumb" tar file on Unix, and a simple
43executable installer on Windows. (That tar file is considered "dumb" because it
44has to be unpacked in a specific location to work.)
45
46Thus, the above command on a Unix system creates
47:file:`Distutils-1.0.{plat}.tar.gz`; unpacking this tarball from the right place
48installs the Distutils just as though you had downloaded the source distribution
49and run ``python setup.py install``. (The "right place" is either the root of
50the filesystem or Python's :file:`{prefix}` directory, depending on the options
51given to the :command:`bdist_dumb` command; the default is to make dumb
52distributions relative to :file:`{prefix}`.)
53
54Obviously, for pure Python distributions, this isn't any simpler than just
55running ``python setup.py install``\ ---but for non-pure distributions, which
56include extensions that would need to be compiled, it can mean the difference
57between someone being able to use your extensions or not. And creating "smart"
58built distributions, such as an RPM package or an executable installer for
59Windows, is far more convenient for users even if your distribution doesn't
60include any extensions.
61
Martin Panter5c679332016-10-30 04:20:17 +000062The :command:`bdist` command has a :option:`!--formats` option, similar to the
Georg Brandl116aa622007-08-15 14:28:22 +000063:command:`sdist` command, which you can use to select the types of built
64distribution to generate: for example, ::
65
66 python setup.py bdist --format=zip
67
Serhiy Storchaka3f819ca2018-10-31 02:26:06 +020068would, when run on a Unix system, create
69:file:`Distutils-1.0.{plat}.zip`\ ---again, this archive would be unpacked
70from the root directory to install the Distutils.
Georg Brandl116aa622007-08-15 14:28:22 +000071
72The available formats for built distributions are:
73
74+-------------+------------------------------+---------+
75| Format | Description | Notes |
76+=============+==============================+=========+
Serhiy Storchakab9cec6a2015-05-16 22:13:27 +030077| ``gztar`` | gzipped tar file | \(1) |
Georg Brandl116aa622007-08-15 14:28:22 +000078| | (:file:`.tar.gz`) | |
79+-------------+------------------------------+---------+
Serhiy Storchakab9cec6a2015-05-16 22:13:27 +030080| ``bztar`` | bzipped tar file | |
81| | (:file:`.tar.bz2`) | |
82+-------------+------------------------------+---------+
83| ``xztar`` | xzipped tar file | |
84| | (:file:`.tar.xz`) | |
85+-------------+------------------------------+---------+
Georg Brandl116aa622007-08-15 14:28:22 +000086| ``ztar`` | compressed tar file | \(3) |
87| | (:file:`.tar.Z`) | |
88+-------------+------------------------------+---------+
Serhiy Storchakab9cec6a2015-05-16 22:13:27 +030089| ``tar`` | tar file (:file:`.tar`) | |
Georg Brandl116aa622007-08-15 14:28:22 +000090+-------------+------------------------------+---------+
Tarek Ziadéf6370502009-04-05 22:57:21 +000091| ``zip`` | zip file (:file:`.zip`) | (2),(4) |
Georg Brandl116aa622007-08-15 14:28:22 +000092+-------------+------------------------------+---------+
93| ``rpm`` | RPM | \(5) |
94+-------------+------------------------------+---------+
95| ``pkgtool`` | Solaris :program:`pkgtool` | |
96+-------------+------------------------------+---------+
97| ``sdux`` | HP-UX :program:`swinstall` | |
98+-------------+------------------------------+---------+
Tarek Ziadéf6370502009-04-05 22:57:21 +000099| ``wininst`` | self-extracting ZIP file for | \(4) |
Georg Brandl116aa622007-08-15 14:28:22 +0000100| | Windows | |
101+-------------+------------------------------+---------+
Tarek Ziadéf6370502009-04-05 22:57:21 +0000102| ``msi`` | Microsoft Installer. | |
103+-------------+------------------------------+---------+
104
Zachary Ware7f142c72015-07-07 00:11:36 -0500105.. versionchanged:: 3.5
Serhiy Storchakab9cec6a2015-05-16 22:13:27 +0300106 Added support for the ``xztar`` format.
107
Georg Brandl116aa622007-08-15 14:28:22 +0000108
109Notes:
110
111(1)
112 default on Unix
113
114(2)
115 default on Windows
116
Georg Brandl116aa622007-08-15 14:28:22 +0000117(3)
Serhiy Storchakab9cec6a2015-05-16 22:13:27 +0300118 requires external :program:`compress` utility.
Georg Brandl116aa622007-08-15 14:28:22 +0000119
120(4)
121 requires either external :program:`zip` utility or :mod:`zipfile` module (part
122 of the standard Python library since Python 1.6)
123
124(5)
125 requires external :program:`rpm` utility, version 3.0.4 or better (use ``rpm
126 --version`` to find out which version you have)
127
Martin Panter5c679332016-10-30 04:20:17 +0000128You don't have to use the :command:`bdist` command with the :option:`!--formats`
Georg Brandl116aa622007-08-15 14:28:22 +0000129option; you can also use the command that directly implements the format you're
130interested in. Some of these :command:`bdist` "sub-commands" actually generate
131several similar formats; for instance, the :command:`bdist_dumb` command
Serhiy Storchakab9cec6a2015-05-16 22:13:27 +0300132generates all the "dumb" archive formats (``tar``, ``gztar``, ``bztar``,
133``xztar``, ``ztar``, and ``zip``), and :command:`bdist_rpm` generates both
134binary and source RPMs. The :command:`bdist` sub-commands, and the formats
135generated by each, are:
Georg Brandl116aa622007-08-15 14:28:22 +0000136
Serhiy Storchakab9cec6a2015-05-16 22:13:27 +0300137+--------------------------+-------------------------------------+
138| Command | Formats |
139+==========================+=====================================+
140| :command:`bdist_dumb` | tar, gztar, bztar, xztar, ztar, zip |
141+--------------------------+-------------------------------------+
142| :command:`bdist_rpm` | rpm, srpm |
143+--------------------------+-------------------------------------+
144| :command:`bdist_wininst` | wininst |
145+--------------------------+-------------------------------------+
146| :command:`bdist_msi` | msi |
147+--------------------------+-------------------------------------+
Georg Brandl116aa622007-08-15 14:28:22 +0000148
149The following sections give details on the individual :command:`bdist_\*`
150commands.
151
152
Georg Brandld5f2d6e2010-07-31 09:15:10 +0000153.. .. _creating-dumb:
Georg Brandl116aa622007-08-15 14:28:22 +0000154
Georg Brandld5f2d6e2010-07-31 09:15:10 +0000155.. Creating dumb built distributions
156.. =================================
Georg Brandl116aa622007-08-15 14:28:22 +0000157
Georg Brandld5f2d6e2010-07-31 09:15:10 +0000158.. XXX Need to document absolute vs. prefix-relative packages here, but first
159 I have to implement it!
Georg Brandl116aa622007-08-15 14:28:22 +0000160
161
162.. _creating-rpms:
163
164Creating RPM packages
165=====================
166
167The RPM format is used by many popular Linux distributions, including Red Hat,
168SuSE, and Mandrake. If one of these (or any of the other RPM-based Linux
169distributions) is your usual environment, creating RPM packages for other users
170of that same distribution is trivial. Depending on the complexity of your module
171distribution and differences between Linux distributions, you may also be able
172to create RPMs that work on different RPM-based distributions.
173
174The usual way to create an RPM of your module distribution is to run the
175:command:`bdist_rpm` command::
176
177 python setup.py bdist_rpm
178
Martin Panter5c679332016-10-30 04:20:17 +0000179or the :command:`bdist` command with the :option:`!--format` option::
Georg Brandl116aa622007-08-15 14:28:22 +0000180
181 python setup.py bdist --formats=rpm
182
183The former allows you to specify RPM-specific options; the latter allows you to
184easily specify multiple formats in one run. If you need to do both, you can
185explicitly specify multiple :command:`bdist_\*` commands and their options::
186
187 python setup.py bdist_rpm --packager="John Doe <jdoe@example.org>" \
Georg Brandl56be37c2010-08-02 19:16:34 +0000188 bdist_wininst --target-version="2.0"
Georg Brandl116aa622007-08-15 14:28:22 +0000189
190Creating RPM packages is driven by a :file:`.spec` file, much as using the
191Distutils is driven by the setup script. To make your life easier, the
192:command:`bdist_rpm` command normally creates a :file:`.spec` file based on the
193information you supply in the setup script, on the command line, and in any
194Distutils configuration files. Various options and sections in the
195:file:`.spec` file are derived from options in the setup script as follows:
196
197+------------------------------------------+----------------------------------------------+
198| RPM :file:`.spec` file option or section | Distutils setup script option |
199+==========================================+==============================================+
Georg Brandl3f40c402014-09-21 00:35:08 +0200200| Name | ``name`` |
Georg Brandl116aa622007-08-15 14:28:22 +0000201+------------------------------------------+----------------------------------------------+
Georg Brandl3f40c402014-09-21 00:35:08 +0200202| Summary (in preamble) | ``description`` |
Georg Brandl116aa622007-08-15 14:28:22 +0000203+------------------------------------------+----------------------------------------------+
Georg Brandl3f40c402014-09-21 00:35:08 +0200204| Version | ``version`` |
Georg Brandl116aa622007-08-15 14:28:22 +0000205+------------------------------------------+----------------------------------------------+
Georg Brandl3f40c402014-09-21 00:35:08 +0200206| Vendor | ``author`` and ``author_email``, |
207| | or --- & ``maintainer`` and |
208| | ``maintainer_email`` |
Georg Brandl116aa622007-08-15 14:28:22 +0000209+------------------------------------------+----------------------------------------------+
Georg Brandl3f40c402014-09-21 00:35:08 +0200210| Copyright | ``license`` |
Georg Brandl116aa622007-08-15 14:28:22 +0000211+------------------------------------------+----------------------------------------------+
Georg Brandl3f40c402014-09-21 00:35:08 +0200212| Url | ``url`` |
Georg Brandl116aa622007-08-15 14:28:22 +0000213+------------------------------------------+----------------------------------------------+
Georg Brandl3f40c402014-09-21 00:35:08 +0200214| %description (section) | ``long_description`` |
Georg Brandl116aa622007-08-15 14:28:22 +0000215+------------------------------------------+----------------------------------------------+
216
217Additionally, there are many options in :file:`.spec` files that don't have
218corresponding options in the setup script. Most of these are handled through
219options to the :command:`bdist_rpm` command as follows:
220
221+-------------------------------+-----------------------------+-------------------------+
222| RPM :file:`.spec` file option | :command:`bdist_rpm` option | default value |
223| or section | | |
224+===============================+=============================+=========================+
Georg Brandl3f40c402014-09-21 00:35:08 +0200225| Release | ``release`` | "1" |
Georg Brandl116aa622007-08-15 14:28:22 +0000226+-------------------------------+-----------------------------+-------------------------+
Georg Brandl3f40c402014-09-21 00:35:08 +0200227| Group | ``group`` | "Development/Libraries" |
Georg Brandl116aa622007-08-15 14:28:22 +0000228+-------------------------------+-----------------------------+-------------------------+
Georg Brandl3f40c402014-09-21 00:35:08 +0200229| Vendor | ``vendor`` | (see above) |
Georg Brandl116aa622007-08-15 14:28:22 +0000230+-------------------------------+-----------------------------+-------------------------+
Georg Brandl3f40c402014-09-21 00:35:08 +0200231| Packager | ``packager`` | (none) |
Georg Brandl116aa622007-08-15 14:28:22 +0000232+-------------------------------+-----------------------------+-------------------------+
Georg Brandl3f40c402014-09-21 00:35:08 +0200233| Provides | ``provides`` | (none) |
Georg Brandl116aa622007-08-15 14:28:22 +0000234+-------------------------------+-----------------------------+-------------------------+
Georg Brandl3f40c402014-09-21 00:35:08 +0200235| Requires | ``requires`` | (none) |
Georg Brandl116aa622007-08-15 14:28:22 +0000236+-------------------------------+-----------------------------+-------------------------+
Georg Brandl3f40c402014-09-21 00:35:08 +0200237| Conflicts | ``conflicts`` | (none) |
Georg Brandl116aa622007-08-15 14:28:22 +0000238+-------------------------------+-----------------------------+-------------------------+
Georg Brandl3f40c402014-09-21 00:35:08 +0200239| Obsoletes | ``obsoletes`` | (none) |
Georg Brandl116aa622007-08-15 14:28:22 +0000240+-------------------------------+-----------------------------+-------------------------+
Georg Brandl3f40c402014-09-21 00:35:08 +0200241| Distribution | ``distribution_name`` | (none) |
Georg Brandl116aa622007-08-15 14:28:22 +0000242+-------------------------------+-----------------------------+-------------------------+
Georg Brandl3f40c402014-09-21 00:35:08 +0200243| BuildRequires | ``build_requires`` | (none) |
Georg Brandl116aa622007-08-15 14:28:22 +0000244+-------------------------------+-----------------------------+-------------------------+
Georg Brandl3f40c402014-09-21 00:35:08 +0200245| Icon | ``icon`` | (none) |
Georg Brandl116aa622007-08-15 14:28:22 +0000246+-------------------------------+-----------------------------+-------------------------+
247
248Obviously, supplying even a few of these options on the command-line would be
249tedious and error-prone, so it's usually best to put them in the setup
250configuration file, :file:`setup.cfg`\ ---see section :ref:`setup-config`. If
251you distribute or package many Python module distributions, you might want to
252put options that apply to all of them in your personal Distutils configuration
Andrew Kuchling2a1838b2013-11-10 18:11:00 -0500253file (:file:`~/.pydistutils.cfg`). If you want to temporarily disable
Martin Panter5c679332016-10-30 04:20:17 +0000254this file, you can pass the :option:`!--no-user-cfg` option to :file:`setup.py`.
Georg Brandl116aa622007-08-15 14:28:22 +0000255
256There are three steps to building a binary RPM package, all of which are
257handled automatically by the Distutils:
258
259#. create a :file:`.spec` file, which describes the package (analogous to the
260 Distutils setup script; in fact, much of the information in the setup script
261 winds up in the :file:`.spec` file)
262
263#. create the source RPM
264
265#. create the "binary" RPM (which may or may not contain binary code, depending
266 on whether your module distribution contains Python extensions)
267
268Normally, RPM bundles the last two steps together; when you use the Distutils,
269all three steps are typically bundled together.
270
271If you wish, you can separate these three steps. You can use the
Martin Panter5c679332016-10-30 04:20:17 +0000272:option:`!--spec-only` option to make :command:`bdist_rpm` just create the
Georg Brandl116aa622007-08-15 14:28:22 +0000273:file:`.spec` file and exit; in this case, the :file:`.spec` file will be
274written to the "distribution directory"---normally :file:`dist/`, but
Martin Panter5c679332016-10-30 04:20:17 +0000275customizable with the :option:`!--dist-dir` option. (Normally, the :file:`.spec`
Georg Brandl116aa622007-08-15 14:28:22 +0000276file winds up deep in the "build tree," in a temporary directory created by
277:command:`bdist_rpm`.)
278
279.. % \XXX{this isn't implemented yet---is it needed?!}
280.. % You can also specify a custom \file{.spec} file with the
281.. % \longprogramopt{spec-file} option; used in conjunction with
282.. % \longprogramopt{spec-only}, this gives you an opportunity to customize
283.. % the \file{.spec} file manually:
Georg Brandl48310cd2009-01-03 21:18:54 +0000284.. %
Georg Brandl116aa622007-08-15 14:28:22 +0000285.. % \ begin{verbatim}
286.. % > python setup.py bdist_rpm --spec-only
287.. % # ...edit dist/FooBar-1.0.spec
288.. % > python setup.py bdist_rpm --spec-file=dist/FooBar-1.0.spec
289.. % \ end{verbatim}
Georg Brandl48310cd2009-01-03 21:18:54 +0000290.. %
Georg Brandl116aa622007-08-15 14:28:22 +0000291.. % (Although a better way to do this is probably to override the standard
292.. % \command{bdist\_rpm} command with one that writes whatever else you want
293.. % to the \file{.spec} file.)
294
295
296.. _creating-wininst:
297
298Creating Windows Installers
299===========================
300
301Executable installers are the natural format for binary distributions on
302Windows. They display a nice graphical user interface, display some information
303about the module distribution to be installed taken from the metadata in the
304setup script, let the user select a few options, and start or cancel the
305installation.
306
307Since the metadata is taken from the setup script, creating Windows installers
308is usually as easy as running::
309
310 python setup.py bdist_wininst
311
Martin Panter5c679332016-10-30 04:20:17 +0000312or the :command:`bdist` command with the :option:`!--formats` option::
Georg Brandl116aa622007-08-15 14:28:22 +0000313
314 python setup.py bdist --formats=wininst
315
316If you have a pure module distribution (only containing pure Python modules and
317packages), the resulting installer will be version independent and have a name
Miss Islington (bot)be5bb522019-07-01 05:54:19 -0700318like :file:`foo-1.0.win32.exe`. Note that creating ``wininst`` binary
319distributions in only supported on Windows systems.
Georg Brandl116aa622007-08-15 14:28:22 +0000320
321If you have a non-pure distribution, the extensions can only be created on a
322Windows platform, and will be Python version dependent. The installer filename
323will reflect this and now has the form :file:`foo-1.0.win32-py2.0.exe`. You
324have to create a separate installer for every Python version you want to
325support.
326
Georg Brandl9afde1c2007-11-01 20:32:30 +0000327The installer will try to compile pure modules into :term:`bytecode` after installation
Georg Brandl116aa622007-08-15 14:28:22 +0000328on the target system in normal and optimizing mode. If you don't want this to
329happen for some reason, you can run the :command:`bdist_wininst` command with
Martin Panter5c679332016-10-30 04:20:17 +0000330the :option:`!--no-target-compile` and/or the :option:`!--no-target-optimize`
Georg Brandl116aa622007-08-15 14:28:22 +0000331option.
332
333By default the installer will display the cool "Python Powered" logo when it is
Benjamin Petersond7c3ed52010-06-27 22:32:30 +0000334run, but you can also supply your own 152x261 bitmap which must be a Windows
Martin Panter5c679332016-10-30 04:20:17 +0000335:file:`.bmp` file with the :option:`!--bitmap` option.
Georg Brandl116aa622007-08-15 14:28:22 +0000336
337The installer will also display a large title on the desktop background window
338when it is run, which is constructed from the name of your distribution and the
339version number. This can be changed to another text by using the
Martin Panter5c679332016-10-30 04:20:17 +0000340:option:`!--title` option.
Georg Brandl116aa622007-08-15 14:28:22 +0000341
342The installer file will be written to the "distribution directory" --- normally
Martin Panter5c679332016-10-30 04:20:17 +0000343:file:`dist/`, but customizable with the :option:`!--dist-dir` option.
Georg Brandl116aa622007-08-15 14:28:22 +0000344
Christian Heimes5e696852008-04-09 08:37:03 +0000345.. _cross-compile-windows:
346
347Cross-compiling on Windows
348==========================
349
Georg Brandl48310cd2009-01-03 21:18:54 +0000350Starting with Python 2.6, distutils is capable of cross-compiling between
351Windows platforms. In practice, this means that with the correct tools
Christian Heimes5e696852008-04-09 08:37:03 +0000352installed, you can use a 32bit version of Windows to create 64bit extensions
353and vice-versa.
354
Martin Panter5c679332016-10-30 04:20:17 +0000355To build for an alternate platform, specify the :option:`!--plat-name` option
Zachary Ware49ce74e2017-09-06 15:45:25 -0700356to the build command. Valid values are currently 'win32', and 'win-amd64'.
357For example, on a 32bit version of Windows, you could execute::
Christian Heimes5e696852008-04-09 08:37:03 +0000358
359 python setup.py build --plat-name=win-amd64
360
Georg Brandl48310cd2009-01-03 21:18:54 +0000361to build a 64bit version of your extension. The Windows Installers also
Christian Heimes5e696852008-04-09 08:37:03 +0000362support this option, so the command::
363
364 python setup.py build --plat-name=win-amd64 bdist_wininst
365
366would create a 64bit installation executable on your 32bit version of Windows.
367
Georg Brandl48310cd2009-01-03 21:18:54 +0000368To cross-compile, you must download the Python source code and cross-compile
Donald Stufft8b852f12014-05-20 12:58:38 -0400369Python itself for the platform you are targeting - it is not possible from a
Georg Brandl6faee4e2010-09-21 14:48:28 +0000370binary installation of Python (as the .lib etc file for other platforms are
Georg Brandl48310cd2009-01-03 21:18:54 +0000371not included.) In practice, this means the user of a 32 bit operating
372system will need to use Visual Studio 2008 to open the
Stefan Grönkef1502d02017-09-25 18:58:10 +0200373:file:`PCbuild/PCbuild.sln` solution in the Python source tree and build the
Georg Brandl48310cd2009-01-03 21:18:54 +0000374"x64" configuration of the 'pythoncore' project before cross-compiling
Christian Heimes5e696852008-04-09 08:37:03 +0000375extensions is possible.
376
377Note that by default, Visual Studio 2008 does not install 64bit compilers or
378tools. You may need to reexecute the Visual Studio setup process and select
379these tools (using Control Panel->[Add/Remove] Programs is a convenient way to
380check or modify your existing install.)
Georg Brandl116aa622007-08-15 14:28:22 +0000381
382.. _postinstallation-script:
383
384The Postinstallation script
385---------------------------
386
Benjamin Petersond7c3ed52010-06-27 22:32:30 +0000387Starting with Python 2.3, a postinstallation script can be specified with the
Martin Panter5c679332016-10-30 04:20:17 +0000388:option:`!--install-script` option. The basename of the script must be
Georg Brandl116aa622007-08-15 14:28:22 +0000389specified, and the script filename must also be listed in the scripts argument
390to the setup function.
391
392This script will be run at installation time on the target system after all the
Martin Panter5c679332016-10-30 04:20:17 +0000393files have been copied, with ``argv[1]`` set to :option:`!-install`, and again at
Georg Brandl116aa622007-08-15 14:28:22 +0000394uninstallation time before the files are removed with ``argv[1]`` set to
Martin Panter5c679332016-10-30 04:20:17 +0000395:option:`!-remove`.
Georg Brandl116aa622007-08-15 14:28:22 +0000396
397The installation script runs embedded in the windows installer, every output
398(``sys.stdout``, ``sys.stderr``) is redirected into a buffer and will be
399displayed in the GUI after the script has finished.
400
401Some functions especially useful in this context are available as additional
402built-in functions in the installation script.
403
404
405.. function:: directory_created(path)
406 file_created(path)
407
408 These functions should be called when a directory or file is created by the
409 postinstall script at installation time. It will register *path* with the
410 uninstaller, so that it will be removed when the distribution is uninstalled.
411 To be safe, directories are only removed if they are empty.
412
413
414.. function:: get_special_folder_path(csidl_string)
415
416 This function can be used to retrieve special folder locations on Windows like
417 the Start Menu or the Desktop. It returns the full path to the folder.
418 *csidl_string* must be one of the following strings::
419
420 "CSIDL_APPDATA"
421
422 "CSIDL_COMMON_STARTMENU"
423 "CSIDL_STARTMENU"
424
425 "CSIDL_COMMON_DESKTOPDIRECTORY"
426 "CSIDL_DESKTOPDIRECTORY"
427
428 "CSIDL_COMMON_STARTUP"
429 "CSIDL_STARTUP"
430
431 "CSIDL_COMMON_PROGRAMS"
432 "CSIDL_PROGRAMS"
433
434 "CSIDL_FONTS"
435
436 If the folder cannot be retrieved, :exc:`OSError` is raised.
437
438 Which folders are available depends on the exact Windows version, and probably
439 also the configuration. For details refer to Microsoft's documentation of the
Georg Brandl60203b42010-10-06 10:11:56 +0000440 :c:func:`SHGetSpecialFolderPath` function.
Georg Brandl116aa622007-08-15 14:28:22 +0000441
442
443.. function:: create_shortcut(target, description, filename[, arguments[, workdir[, iconpath[, iconindex]]]])
444
445 This function creates a shortcut. *target* is the path to the program to be
446 started by the shortcut. *description* is the description of the shortcut.
447 *filename* is the title of the shortcut that the user will see. *arguments*
448 specifies the command line arguments, if any. *workdir* is the working directory
449 for the program. *iconpath* is the file containing the icon for the shortcut,
450 and *iconindex* is the index of the icon in the file *iconpath*. Again, for
451 details consult the Microsoft documentation for the :class:`IShellLink`
452 interface.
Benjamin Peterson8719ad52009-09-11 22:24:02 +0000453
454
455Vista User Access Control (UAC)
456===============================
457
Martin Panter5c679332016-10-30 04:20:17 +0000458Starting with Python 2.6, bdist_wininst supports a :option:`!--user-access-control`
Benjamin Peterson8719ad52009-09-11 22:24:02 +0000459option. The default is 'none' (meaning no UAC handling is done), and other
460valid values are 'auto' (meaning prompt for UAC elevation if Python was
461installed for all users) and 'force' (meaning always prompt for elevation).