<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>5. Creating Built Distributions — Python v2.6.6 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '2.6.6',
COLLAPSE_MODINDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<link rel="search" type="application/opensearchdescription+xml"
title="Search within Python v2.6.6 documentation"
href="../_static/opensearch.xml"/>
<link rel="author" title="About these documents" href="../about.html" />
<link rel="copyright" title="Copyright" href="../copyright.html" />
<link rel="top" title="Python v2.6.6 documentation" href="../index.html" />
<link rel="up" title="Distributing Python Modules" href="index.html" />
<link rel="next" title="6. Registering with the Package Index" href="packageindex.html" />
<link rel="prev" title="4. Creating a Source Distribution" href="sourcedist.html" />
<link rel="shortcut icon" type="image/png" href="../_static/py.png" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../modindex.html" title="Global Module Index"
accesskey="M">modules</a> |</li>
<li class="right" >
<a href="packageindex.html" title="6. Registering with the Package Index"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="sourcedist.html" title="4. Creating a Source Distribution"
accesskey="P">previous</a> |</li>
<li><img src="../_static/py.png" alt=""
style="vertical-align: middle; margin-top: -1px"/></li>
<li><a href="../index.html">Python v2.6.6 documentation</a> »</li>
<li><a href="index.html" accesskey="U">Distributing Python Modules</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="creating-built-distributions">
<span id="built-dist"></span><h1>5. Creating Built Distributions<a class="headerlink" href="#creating-built-distributions" title="Permalink to this headline">¶</a></h1>
<p>A “built distribution” is what you’re probably used to thinking of either as a
“binary package” or an “installer” (depending on your background). It’s not
necessarily binary, though, because it might contain only Python source code
and/or byte-code; and we don’t call it a package, because that word is already
spoken for in Python. (And “installer” is a term specific to the world of
mainstream desktop systems.)</p>
<p>A built distribution is how you make life as easy as possible for installers of
your module distribution: for users of RPM-based Linux systems, it’s a binary
RPM; for Windows users, it’s an executable installer; for Debian-based Linux
users, it’s a Debian package; and so forth. Obviously, no one person will be
able to create built distributions for every platform under the sun, so the
Distutils are designed to enable module developers to concentrate on their
specialty—writing code and creating source distributions—while an
intermediary species called <em>packagers</em> springs up to turn source distributions
into built distributions for as many platforms as there are packagers.</p>
<p>Of course, the module developer could be his own packager; or the packager could
be a volunteer “out there” somewhere who has access to a platform which the
original developer does not; or it could be software periodically grabbing new
source distributions and turning them into built distributions for as many
platforms as the software has access to. Regardless of who they are, a packager
uses the setup script and the <strong>bdist</strong> command family to generate built
distributions.</p>
<p>As a simple example, if I run the following command in the Distutils source
tree:</p>
<div class="highlight-python"><pre>python setup.py bdist</pre>
</div>
<p>then the Distutils builds my module distribution (the Distutils itself in this
case), does a “fake” installation (also in the <tt class="docutils literal"><span class="pre">build</span></tt> directory), and
creates the default type of built distribution for my platform. The default
format for built distributions is a “dumb” tar file on Unix, and a simple
executable installer on Windows. (That tar file is considered “dumb” because it
has to be unpacked in a specific location to work.)</p>
<p>Thus, the above command on a Unix system creates
<tt class="docutils literal"><span class="pre">Distutils-1.0.</span><em><span class="pre">plat</span></em><span class="pre">.tar.gz</span></tt>; unpacking this tarball from the right place
installs the Distutils just as though you had downloaded the source distribution
and run <tt class="docutils literal"><span class="pre">python</span> <span class="pre">setup.py</span> <span class="pre">install</span></tt>. (The “right place” is either the root of
the filesystem or Python’s <tt class="docutils literal"><em><span class="pre">prefix</span></em></tt> directory, depending on the options
given to the <strong>bdist_dumb</strong> command; the default is to make dumb
distributions relative to <tt class="docutils literal"><em><span class="pre">prefix</span></em></tt>.)</p>
<p>Obviously, for pure Python distributions, this isn’t any simpler than just
running <tt class="docutils literal"><span class="pre">python</span> <span class="pre">setup.py</span> <span class="pre">install</span></tt>—but for non-pure distributions, which
include extensions that would need to be compiled, it can mean the difference
between someone being able to use your extensions or not. And creating “smart”
built distributions, such as an RPM package or an executable installer for
Windows, is far more convenient for users even if your distribution doesn’t
include any extensions.</p>
<p>The <strong>bdist</strong> command has a <em class="xref">--formats</em> option, similar to the
<strong>sdist</strong> command, which you can use to select the types of built
distribution to generate: for example,</p>
<div class="highlight-python"><pre>python setup.py bdist --format=zip</pre>
</div>
<p>would, when run on a Unix system, create <tt class="docutils literal"><span class="pre">Distutils-1.0.</span><em><span class="pre">plat</span></em><span class="pre">.zip</span></tt>—again, this archive would be unpacked from the root directory to install the
Distutils.</p>
<p>The available formats for built distributions are:</p>
<table border="1" class="docutils">
<colgroup>
<col width="25%" />
<col width="58%" />
<col width="17%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">Format</th>
<th class="head">Description</th>
<th class="head">Notes</th>
</tr>
</thead>
<tbody valign="top">
<tr><td><tt class="docutils literal"><span class="pre">gztar</span></tt></td>
<td>gzipped tar file
(<tt class="docutils literal"><span class="pre">.tar.gz</span></tt>)</td>
<td>(1),(3)</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">ztar</span></tt></td>
<td>compressed tar file
(<tt class="docutils literal"><span class="pre">.tar.Z</span></tt>)</td>
<td>(3)</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">tar</span></tt></td>
<td>tar file (<tt class="docutils literal"><span class="pre">.tar</span></tt>)</td>
<td>(3)</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">zip</span></tt></td>
<td>zip file (<tt class="docutils literal"><span class="pre">.zip</span></tt>)</td>
<td>(4)</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">rpm</span></tt></td>
<td>RPM</td>
<td>(5)</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">pkgtool</span></tt></td>
<td>Solaris <strong>pkgtool</strong></td>
<td> </td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">sdux</span></tt></td>
<td>HP-UX <strong>swinstall</strong></td>
<td> </td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">rpm</span></tt></td>
<td>RPM</td>
<td>(5)</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">wininst</span></tt></td>
<td>self-extracting ZIP file for
Windows</td>
<td>(2),(4)</td>
</tr>
</tbody>
</table>
<p>Notes:</p>
<ol class="arabic">
<li><p class="first">default on Unix</p>
</li>
<li><p class="first">default on Windows</p>
<p><strong>**</strong> to-do! <strong>**</strong></p>
</li>
<li><p class="first">requires external utilities: <strong>tar</strong> and possibly one of <strong>gzip</strong>,
<strong>bzip2</strong>, or <strong>compress</strong></p>
</li>
<li><p class="first">requires either external <strong>zip</strong> utility or <a title="Read and write ZIP-format archive files." class="reference external" href="../library/zipfile.html#module-zipfile"><tt class="xref docutils literal"><span class="pre">zipfile</span></tt></a> module (part
of the standard Python library since Python 1.6)</p>
</li>
<li><p class="first">requires external <strong>rpm</strong> utility, version 3.0.4 or better (use <tt class="docutils literal"><span class="pre">rpm</span>
<span class="pre">--version</span></tt> to find out which version you have)</p>
</li>
</ol>
<p>You don’t have to use the <strong>bdist</strong> command with the <em class="xref">--formats</em>
option; you can also use the command that directly implements the format you’re
interested in. Some of these <strong>bdist</strong> “sub-commands” actually generate
several similar formats; for instance, the <strong>bdist_dumb</strong> command
generates all the “dumb” archive formats (<tt class="docutils literal"><span class="pre">tar</span></tt>, <tt class="docutils literal"><span class="pre">ztar</span></tt>, <tt class="docutils literal"><span class="pre">gztar</span></tt>, and
<tt class="docutils literal"><span class="pre">zip</span></tt>), and <strong>bdist_rpm</strong> generates both binary and source RPMs. The
<strong>bdist</strong> sub-commands, and the formats generated by each, are:</p>
<table border="1" class="docutils">
<colgroup>
<col width="53%" />
<col width="47%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">Command</th>
<th class="head">Formats</th>
</tr>
</thead>
<tbody valign="top">
<tr><td><strong>bdist_dumb</strong></td>
<td>tar, ztar, gztar, zip</td>
</tr>
<tr><td><strong>bdist_rpm</strong></td>
<td>rpm, srpm</td>
</tr>
<tr><td><strong>bdist_wininst</strong></td>
<td>wininst</td>
</tr>
</tbody>
</table>
<p>The following sections give details on the individual <strong>bdist_*</strong>
commands.</p>
<div class="section" id="creating-dumb-built-distributions">
<span id="creating-dumb"></span><h2>5.1. Creating dumb built distributions<a class="headerlink" href="#creating-dumb-built-distributions" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="creating-rpm-packages">
<span id="creating-rpms"></span><h2>5.2. Creating RPM packages<a class="headerlink" href="#creating-rpm-packages" title="Permalink to this headline">¶</a></h2>
<p>The RPM format is used by many popular Linux distributions, including Red Hat,
SuSE, and Mandrake. If one of these (or any of the other RPM-based Linux
distributions) is your usual environment, creating RPM packages for other users
of that same distribution is trivial. Depending on the complexity of your module
distribution and differences between Linux distributions, you may also be able
to create RPMs that work on different RPM-based distributions.</p>
<p>The usual way to create an RPM of your module distribution is to run the
<strong>bdist_rpm</strong> command:</p>
<div class="highlight-python"><pre>python setup.py bdist_rpm</pre>
</div>
<p>or the <strong>bdist</strong> command with the <em class="xref">--format</em> option:</p>
<div class="highlight-python"><pre>python setup.py bdist --formats=rpm</pre>
</div>
<p>The former allows you to specify RPM-specific options; the latter allows you to
easily specify multiple formats in one run. If you need to do both, you can
explicitly specify multiple <strong>bdist_*</strong> commands and their options:</p>
<div class="highlight-python"><pre>python setup.py bdist_rpm --packager="John Doe <jdoe@example.org>" \
bdist_wininst --target-version="2.0"</pre>
</div>
<p>Creating RPM packages is driven by a <tt class="docutils literal"><span class="pre">.spec</span></tt> file, much as using the
Distutils is driven by the setup script. To make your life easier, the
<strong>bdist_rpm</strong> command normally creates a <tt class="docutils literal"><span class="pre">.spec</span></tt> file based on the
information you supply in the setup script, on the command line, and in any
Distutils configuration files. Various options and sections in the
<tt class="docutils literal"><span class="pre">.spec</span></tt> file are derived from options in the setup script as follows:</p>
<table border="1" class="docutils">
<colgroup>
<col width="48%" />
<col width="52%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">RPM <tt class="docutils literal"><span class="pre">.spec</span></tt> file option or section</th>
<th class="head">Distutils setup script option</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>Name</td>
<td><em class="xref">name</em></td>
</tr>
<tr><td>Summary (in preamble)</td>
<td><em class="xref">description</em></td>
</tr>
<tr><td>Version</td>
<td><em class="xref">version</em></td>
</tr>
<tr><td>Vendor</td>
<td><em class="xref">author</em> and <em class="xref">author_email</em>,
or — & <em class="xref">maintainer</em> and
<em class="xref">maintainer_email</em></td>
</tr>
<tr><td>Copyright</td>
<td><em class="xref">license</em></td>
</tr>
<tr><td>Url</td>
<td><em class="xref">url</em></td>
</tr>
<tr><td>%description (section)</td>
<td><em class="xref">long_description</em></td>
</tr>
</tbody>
</table>
<p>Additionally, there are many options in <tt class="docutils literal"><span class="pre">.spec</span></tt> files that don’t have
corresponding options in the setup script. Most of these are handled through
options to the <strong>bdist_rpm</strong> command as follows:</p>
<table border="1" class="docutils">
<colgroup>
<col width="36%" />
<col width="34%" />
<col width="29%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">RPM <tt class="docutils literal"><span class="pre">.spec</span></tt> file option
or section</th>
<th class="head"><strong>bdist_rpm</strong> option</th>
<th class="head">default value</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>Release</td>
<td><em class="xref">release</em></td>
<td>“1”</td>
</tr>
<tr><td>Group</td>
<td><em class="xref">group</em></td>
<td>“Development/Libraries”</td>
</tr>
<tr><td>Vendor</td>
<td><em class="xref">vendor</em></td>
<td>(see above)</td>
</tr>
<tr><td>Packager</td>
<td><em class="xref">packager</em></td>
<td>(none)</td>
</tr>
<tr><td>Provides</td>
<td><em class="xref">provides</em></td>
<td>(none)</td>
</tr>
<tr><td>Requires</td>
<td><em class="xref">requires</em></td>
<td>(none)</td>
</tr>
<tr><td>Conflicts</td>
<td><em class="xref">conflicts</em></td>
<td>(none)</td>
</tr>
<tr><td>Obsoletes</td>
<td><em class="xref">obsoletes</em></td>
<td>(none)</td>
</tr>
<tr><td>Distribution</td>
<td><em class="xref">distribution_name</em></td>
<td>(none)</td>
</tr>
<tr><td>BuildRequires</td>
<td><em class="xref">build_requires</em></td>
<td>(none)</td>
</tr>
<tr><td>Icon</td>
<td><em class="xref">icon</em></td>
<td>(none)</td>
</tr>
</tbody>
</table>
<p>Obviously, supplying even a few of these options on the command-line would be
tedious and error-prone, so it’s usually best to put them in the setup
configuration file, <tt class="docutils literal"><span class="pre">setup.cfg</span></tt>—see section <a class="reference external" href="configfile.html#setup-config"><em>Writing the Setup Configuration File</em></a>. If
you distribute or package many Python module distributions, you might want to
put options that apply to all of them in your personal Distutils configuration
file (<tt class="docutils literal"><span class="pre">~/.pydistutils.cfg</span></tt>).</p>
<p>There are three steps to building a binary RPM package, all of which are
handled automatically by the Distutils:</p>
<ol class="arabic simple">
<li>create a <tt class="docutils literal"><span class="pre">.spec</span></tt> file, which describes the package (analogous to the
Distutils setup script; in fact, much of the information in the setup script
winds up in the <tt class="docutils literal"><span class="pre">.spec</span></tt> file)</li>
<li>create the source RPM</li>
<li>create the “binary” RPM (which may or may not contain binary code, depending
on whether your module distribution contains Python extensions)</li>
</ol>
<p>Normally, RPM bundles the last two steps together; when you use the Distutils,
all three steps are typically bundled together.</p>
<p>If you wish, you can separate these three steps. You can use the
<em class="xref">--spec-only</em> option to make <strong>bdist_rpm</strong> just create the
<tt class="docutils literal"><span class="pre">.spec</span></tt> file and exit; in this case, the <tt class="docutils literal"><span class="pre">.spec</span></tt> file will be
written to the “distribution directory”—normally <tt class="docutils literal"><span class="pre">dist/</span></tt>, but
customizable with the <em class="xref">--dist-dir</em> option. (Normally, the <tt class="docutils literal"><span class="pre">.spec</span></tt>
file winds up deep in the “build tree,” in a temporary directory created by
<strong>bdist_rpm</strong>.)</p>
</div>
<div class="section" id="creating-windows-installers">
<span id="creating-wininst"></span><h2>5.3. Creating Windows Installers<a class="headerlink" href="#creating-windows-installers" title="Permalink to this headline">¶</a></h2>
<p>Executable installers are the natural format for binary distributions on
Windows. They display a nice graphical user interface, display some information
about the module distribution to be installed taken from the metadata in the
setup script, let the user select a few options, and start or cancel the
installation.</p>
<p>Since the metadata is taken from the setup script, creating Windows installers
is usually as easy as running:</p>
<div class="highlight-python"><pre>python setup.py bdist_wininst</pre>
</div>
<p>or the <strong>bdist</strong> command with the <em class="xref">--formats</em> option:</p>
<div class="highlight-python"><pre>python setup.py bdist --formats=wininst</pre>
</div>
<p>If you have a pure module distribution (only containing pure Python modules and
packages), the resulting installer will be version independent and have a name
like <tt class="docutils literal"><span class="pre">foo-1.0.win32.exe</span></tt>. These installers can even be created on Unix
platforms or Mac OS X.</p>
<p>If you have a non-pure distribution, the extensions can only be created on a
Windows platform, and will be Python version dependent. The installer filename
will reflect this and now has the form <tt class="docutils literal"><span class="pre">foo-1.0.win32-py2.0.exe</span></tt>. You
have to create a separate installer for every Python version you want to
support.</p>
<p>The installer will try to compile pure modules into <a class="reference external" href="../glossary.html#term-bytecode"><em class="xref">bytecode</em></a> after installation
on the target system in normal and optimizing mode. If you don’t want this to
happen for some reason, you can run the <strong>bdist_wininst</strong> command with
the <em class="xref">--no-target-compile</em> and/or the <em class="xref">--no-target-optimize</em>
option.</p>
<p>By default the installer will display the cool “Python Powered” logo when it is
run, but you can also supply your own 152x161 bitmap which must be a Windows
<tt class="docutils literal"><span class="pre">.bmp</span></tt> file with the <em class="xref">--bitmap</em> option.</p>
<p>The installer will also display a large title on the desktop background window
when it is run, which is constructed from the name of your distribution and the
version number. This can be changed to another text by using the
<em class="xref">--title</em> option.</p>
<p>The installer file will be written to the “distribution directory” — normally
<tt class="docutils literal"><span class="pre">dist/</span></tt>, but customizable with the <em class="xref">--dist-dir</em> option.</p>
</div>
<div class="section" id="cross-compiling-on-windows">
<span id="cross-compile-windows"></span><h2>5.4. Cross-compiling on Windows<a class="headerlink" href="#cross-compiling-on-windows" title="Permalink to this headline">¶</a></h2>
<p>Starting with Python 2.6, distutils is capable of cross-compiling between
Windows platforms. In practice, this means that with the correct tools
installed, you can use a 32bit version of Windows to create 64bit extensions
and vice-versa.</p>
<p>To build for an alternate platform, specify the <em class="xref">--plat-name</em> option
to the build command. Valid values are currently ‘win32’, ‘win-amd64’ and
‘win-ia64’. For example, on a 32bit version of Windows, you could execute:</p>
<div class="highlight-python"><pre>python setup.py build --plat-name=win-amd64</pre>
</div>
<p>to build a 64bit version of your extension. The Windows Installers also
support this option, so the command:</p>
<div class="highlight-python"><pre>python setup.py build --plat-name=win-amd64 bdist_wininst</pre>
</div>
<p>would create a 64bit installation executable on your 32bit version of Windows.</p>
<p>To cross-compile, you must download the Python source code and cross-compile
Python itself for the platform you are targetting - it is not possible from a
binary installtion of Python (as the .lib etc file for other platforms are
not included.) In practice, this means the user of a 32 bit operating
system will need to use Visual Studio 2008 to open the
<tt class="docutils literal"><span class="pre">PCBuild/PCbuild.sln</span></tt> solution in the Python source tree and build the
“x64” configuration of the ‘pythoncore’ project before cross-compiling
extensions is possible.</p>
<p>Note that by default, Visual Studio 2008 does not install 64bit compilers or
tools. You may need to reexecute the Visual Studio setup process and select
these tools (using Control Panel->[Add/Remove] Programs is a convenient way to
check or modify your existing install.)</p>
<div class="section" id="the-postinstallation-script">
<span id="postinstallation-script"></span><h3>5.4.1. The Postinstallation script<a class="headerlink" href="#the-postinstallation-script" title="Permalink to this headline">¶</a></h3>
<p>Starting with Python 2.3, a postinstallation script can be specified which the
<em class="xref">--install-script</em> option. The basename of the script must be
specified, and the script filename must also be listed in the scripts argument
to the setup function.</p>
<p>This script will be run at installation time on the target system after all the
files have been copied, with <tt class="docutils literal"><span class="pre">argv[1]</span></tt> set to <em class="xref">-install</em>, and again at
uninstallation time before the files are removed with <tt class="docutils literal"><span class="pre">argv[1]</span></tt> set to
<em class="xref">-remove</em>.</p>
<p>The installation script runs embedded in the windows installer, every output
(<tt class="docutils literal"><span class="pre">sys.stdout</span></tt>, <tt class="docutils literal"><span class="pre">sys.stderr</span></tt>) is redirected into a buffer and will be
displayed in the GUI after the script has finished.</p>
<p>Some functions especially useful in this context are available as additional
built-in functions in the installation script.</p>
<dl class="function">
<dt id="directory_created">
<tt class="descname">directory_created</tt><big>(</big><em>path</em><big>)</big><a class="headerlink" href="#directory_created" title="Permalink to this definition">¶</a></dt>
<dt id="file_created">
<tt class="descname">file_created</tt><big>(</big><em>path</em><big>)</big><a class="headerlink" href="#file_created" title="Permalink to this definition">¶</a></dt>
<dd>These functions should be called when a directory or file is created by the
postinstall script at installation time. It will register <em>path</em> with the
uninstaller, so that it will be removed when the distribution is uninstalled.
To be safe, directories are only removed if they are empty.</dd></dl>
<dl class="function">
<dt id="get_special_folder_path">
<tt class="descname">get_special_folder_path</tt><big>(</big><em>csidl_string</em><big>)</big><a class="headerlink" href="#get_special_folder_path" title="Permalink to this definition">¶</a></dt>
<dd><p>This function can be used to retrieve special folder locations on Windows like
the Start Menu or the Desktop. It returns the full path to the folder.
<em>csidl_string</em> must be one of the following strings:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="s">"CSIDL_APPDATA"</span>
<span class="s">"CSIDL_COMMON_STARTMENU"</span>
<span class="s">"CSIDL_STARTMENU"</span>
<span class="s">"CSIDL_COMMON_DESKTOPDIRECTORY"</span>
<span class="s">"CSIDL_DESKTOPDIRECTORY"</span>
<span class="s">"CSIDL_COMMON_STARTUP"</span>
<span class="s">"CSIDL_STARTUP"</span>
<span class="s">"CSIDL_COMMON_PROGRAMS"</span>
<span class="s">"CSIDL_PROGRAMS"</span>
<span class="s">"CSIDL_FONTS"</span>
</pre></div>
</div>
<p>If the folder cannot be retrieved, <a title="exceptions.OSError" class="reference external" href="../library/exceptions.html#exceptions.OSError"><tt class="xref docutils literal"><span class="pre">OSError</span></tt></a> is raised.</p>
<p>Which folders are available depends on the exact Windows version, and probably
also the configuration. For details refer to Microsoft’s documentation of the
<tt class="xref docutils literal"><span class="pre">SHGetSpecialFolderPath()</span></tt> function.</p>
</dd></dl>
<dl class="function">
<dt id="create_shortcut">
<tt class="descname">create_shortcut</tt><big>(</big><em>target</em>, <em>description</em>, <em>filename</em><span class="optional">[</span>, <em>arguments</em><span class="optional">[</span>, <em>workdir</em><span class="optional">[</span>, <em>iconpath</em><span class="optional">[</span>, <em>iconindex</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#create_shortcut" title="Permalink to this definition">¶</a></dt>
<dd>This function creates a shortcut. <em>target</em> is the path to the program to be
started by the shortcut. <em>description</em> is the description of the shortcut.
<em>filename</em> is the title of the shortcut that the user will see. <em>arguments</em>
specifies the command line arguments, if any. <em>workdir</em> is the working directory
for the program. <em>iconpath</em> is the file containing the icon for the shortcut,
and <em>iconindex</em> is the index of the icon in the file <em>iconpath</em>. Again, for
details consult the Microsoft documentation for the <tt class="xref docutils literal"><span class="pre">IShellLink</span></tt>
interface.</dd></dl>
</div>
</div>
<div class="section" id="vista-user-access-control-uac">
<h2>5.5. Vista User Access Control (UAC)<a class="headerlink" href="#vista-user-access-control-uac" title="Permalink to this headline">¶</a></h2>
<p>Starting with Python 2.6, bdist_wininst supports a <em class="xref">--user-access-control</em>
option. The default is ‘none’ (meaning no UAC handling is done), and other
valid values are ‘auto’ (meaning prompt for UAC elevation if Python was
installed for all users) and ‘force’ (meaning always prompt for elevation).</p>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="../contents.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference external" href="#">5. Creating Built Distributions</a><ul>
<li><a class="reference external" href="#creating-dumb-built-distributions">5.1. Creating dumb built distributions</a></li>
<li><a class="reference external" href="#creating-rpm-packages">5.2. Creating RPM packages</a></li>
<li><a class="reference external" href="#creating-windows-installers">5.3. Creating Windows Installers</a></li>
<li><a class="reference external" href="#cross-compiling-on-windows">5.4. Cross-compiling on Windows</a><ul>
<li><a class="reference external" href="#the-postinstallation-script">5.4.1. The Postinstallation script</a></li>
</ul>
</li>
<li><a class="reference external" href="#vista-user-access-control-uac">5.5. Vista User Access Control (UAC)</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="sourcedist.html"
title="previous chapter">4. Creating a Source Distribution</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="packageindex.html"
title="next chapter">6. Registering with the Package Index</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../bugs.html">Report a Bug</a></li>
<li><a href="../_sources/distutils/builtdist.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" size="18" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../modindex.html" title="Global Module Index"
>modules</a> |</li>
<li class="right" >
<a href="packageindex.html" title="6. Registering with the Package Index"
>next</a> |</li>
<li class="right" >
<a href="sourcedist.html" title="4. Creating a Source Distribution"
>previous</a> |</li>
<li><img src="../_static/py.png" alt=""
style="vertical-align: middle; margin-top: -1px"/></li>
<li><a href="../index.html">Python v2.6.6 documentation</a> »</li>
<li><a href="index.html" >Distributing Python Modules</a> »</li>
</ul>
</div>
<div class="footer">
© <a href="../copyright.html">Copyright</a> 1990-2011, Python Software Foundation.
<br />
The Python Software Foundation is a non-profit corporation.
<a href="http://www.python.org/psf/donations/">Please donate.</a>
<br />
Last updated on Jul 20, 2011.
<a href="../bugs.html">Found a bug</a>?
<br />
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.6.
</div>
</body>
</html>
Copyright 2K16 - 2K18 Indonesian Hacker Rulez