This file is indexed.

/usr/share/doc/dh-virtualenv/html/usage.html is in dh-virtualenv 0.11-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
<!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>Building packages with dh-virtualenv &mdash; dh-virtualenv 0.11 documentation</title>
    
    <link rel="stylesheet" href="_static/classic.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    './',
        VERSION:     '0.11',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="dh-virtualenv 0.11 documentation" href="index.html" />
    <link rel="prev" title="Tutorial" href="tutorial.html" /> 
  </head>
  <body role="document">
    <div class="related" role="navigation" aria-label="related navigation">
      <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="tutorial.html" title="Tutorial"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">dh-virtualenv 0.11 documentation</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="building-packages-with-dh-virtualenv">
<h1>Building packages with dh-virtualenv<a class="headerlink" href="#building-packages-with-dh-virtualenv" title="Permalink to this headline"></a></h1>
<p>Building packages with <em>dh-virtualenv</em> is relatively easy to start
with but it also supports lot of customization to fit in your general
needs.</p>
<p>By default, <em>dh-virtualenv</em> installs your packages under
<code class="docutils literal"><span class="pre">/usr/share/python/&lt;packagename&gt;</span></code>. The package name is provided by
the <code class="docutils literal"><span class="pre">debian/control</span></code> file.</p>
<p>To use an alternative install prefix, add a line like</p>
<div class="highlight-make"><div class="highlight"><pre><span class="k">export </span><span class="nv">DH_VIRTUALENV_INSTALL_ROOT</span><span class="o">=</span>&lt;/your/custom/install/dir&gt;
</pre></div>
</div>
<p>to the top of your <code class="docutils literal"><span class="pre">debian/rules</span></code> file. dh_virtualenv will use
DH_VIRTUALENV_INSTALL_ROOT instead of <code class="docutils literal"><span class="pre">/usr/share/python</span></code> when it
constructs the install path.</p>
<p>To use an install suffix other than the package name, call the
<code class="docutils literal"><span class="pre">dh_virtualenv</span></code> command using with the <code class="docutils literal"><span class="pre">--install-suffix</span></code>
command line option. See Advanced Usage for further information
on passing options.</p>
<div class="section" id="simple-usecase">
<h2>Simple usecase<a class="headerlink" href="#simple-usecase" title="Permalink to this headline"></a></h2>
<p>To signal debhelper to use <em>dh-virtualenv</em> for building your
package, you need to pass <code class="docutils literal"><span class="pre">--with</span> <span class="pre">python-virtualenv</span></code> to debhelper
sequencer.</p>
<p>In a nutshell, the simplest <code class="docutils literal"><span class="pre">debian/rules</span></code> file to build using
<em>dh-virtualenv</em> looks like this:</p>
<div class="highlight-make"><div class="highlight"><pre><span class="c">#!/usr/bin/make -f</span>

<span class="nf">%</span><span class="o">:</span>
      dh <span class="nv">$@</span> --with python-virtualenv
</pre></div>
</div>
<p>However, the tool makes a few assumptions of your project&#8217;s structure:</p>
<blockquote>
<div><ul class="simple">
<li>For installing requirements, you need to have a file called
<code class="docutils literal"><span class="pre">requirements.txt</span></code> in the root directory of your project. The
requirements file is not mandatory.</li>
<li>The project must have a <code class="docutils literal"><span class="pre">setup.py</span></code> file in the root of the
project. Sequencer will run <code class="docutils literal"><span class="pre">setup.py</span> <span class="pre">install</span></code> to install the
package inside the virtualenv.</li>
</ul>
</div></blockquote>
<p>After these are place, you can just build the package with your
favorite tool!</p>
</div>
<div class="section" id="command-line-options">
<h2>Command line options<a class="headerlink" href="#command-line-options" title="Permalink to this headline"></a></h2>
<p>To change the default behavior the <code class="docutils literal"><span class="pre">dh_virtualenv</span></code> command accepts a
few command line options:</p>
<dl class="cmdoption">
<dt id="cmdoption-p">
<span id="cmdoption--package"></span><code class="descname">-p</code><code class="descclassname"> &lt;package&gt;</code><code class="descclassname">, </code><code class="descname">--package</code><code class="descclassname"> &lt;package&gt;</code><a class="headerlink" href="#cmdoption-p" title="Permalink to this definition"></a></dt>
<dd><p>Act on the package named <em>&lt;package&gt;</em></p>
</dd></dl>

<dl class="cmdoption">
<dt id="cmdoption-N">
<span id="cmdoption--no-package"></span><code class="descname">-N</code><code class="descclassname"> &lt;package&gt;</code><code class="descclassname">, </code><code class="descname">--no-package</code><code class="descclassname"> &lt;package&gt;</code><a class="headerlink" href="#cmdoption-N" title="Permalink to this definition"></a></dt>
<dd><p>Do not act on the specified package</p>
</dd></dl>

<dl class="cmdoption">
<dt id="cmdoption-v">
<span id="cmdoption--verbose"></span><code class="descname">-v</code><code class="descclassname"></code><code class="descclassname">, </code><code class="descname">--verbose</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption-v" title="Permalink to this definition"></a></dt>
<dd><p>Turn on verbose mode. This has a few effects: it sets root logger
level to <code class="docutils literal"><span class="pre">DEBUG</span></code> and passes verbose flag to <code class="docutils literal"><span class="pre">pip</span></code> when
installing packages. This can also be provided using the standard
<code class="docutils literal"><span class="pre">DH_VERBOSE</span></code> environment variable.</p>
</dd></dl>

<dl class="cmdoption">
<dt id="cmdoption--install-suffix">
<code class="descname">--install-suffix</code><code class="descclassname"> &lt;suffix&gt;</code><a class="headerlink" href="#cmdoption--install-suffix" title="Permalink to this definition"></a></dt>
<dd><p>Override virtualenv installation suffix. The suffix is appended to
<code class="docutils literal"><span class="pre">/usr/share/python</span></code>, or the <code class="docutils literal"><span class="pre">DH_VIRTUALENV_INSTALL_ROOT</span></code>
environment variable if specified, to construct the installation
path.</p>
</dd></dl>

<dl class="cmdoption">
<dt id="cmdoption--extra-index-url">
<code class="descname">--extra-index-url</code><code class="descclassname"> &lt;url&gt;</code><a class="headerlink" href="#cmdoption--extra-index-url" title="Permalink to this definition"></a></dt>
<dd><p>Use extra index url <em>&lt;url&gt;</em> when running <code class="docutils literal"><span class="pre">pip</span></code> to install
packages. This can be provided multiple times to pass multiple URLs
to <code class="docutils literal"><span class="pre">pip</span></code>. This is useful if you for example have a private Python
Package Index.</p>
</dd></dl>

<dl class="cmdoption">
<dt id="cmdoption--preinstall">
<code class="descname">--preinstall</code><code class="descclassname"> &lt;package&gt;</code><a class="headerlink" href="#cmdoption--preinstall" title="Permalink to this definition"></a></dt>
<dd><p>Package to install before processing the requirements. This flag
can be used to provide a package that is installed by <code class="docutils literal"><span class="pre">pip</span></code>
before processing requirements file. This is handy if you need to
install for example a custom setup script or other packages needed
to parse <code class="docutils literal"><span class="pre">setup.py</span></code>. This flag can be provided multiple times to
pass multiple packages for pre-install.</p>
</dd></dl>

<dl class="cmdoption">
<dt id="cmdoption--pypi-url">
<code class="descname">--pypi-url</code><code class="descclassname"> &lt;URL&gt;</code><a class="headerlink" href="#cmdoption--pypi-url" title="Permalink to this definition"></a></dt>
<dd><p>Base URL of the PyPI server. This flag can be used to pass in a
custom URL to a PyPI mirror. It&#8217;s useful if you for example have an
internal mirror of the PyPI or you run a special instance that only
exposes selected packages of PyPI. If this is not provided, the
default will be whatever <code class="docutils literal"><span class="pre">pip</span></code> uses as default (usually
<code class="docutils literal"><span class="pre">http://pypi.python.org/simple</span></code>).</p>
</dd></dl>

<dl class="cmdoption">
<dt id="cmdoption--extra-pip-arg">
<code class="descname">--extra-pip-arg</code><code class="descclassname"> &lt;PIP ARG&gt;</code><a class="headerlink" href="#cmdoption--extra-pip-arg" title="Permalink to this definition"></a></dt>
<dd><p>Extra parameters to pass to the pip executable. This is useful if
you need to change the behaviour of pip during the packaging process.
You can use this flag multiple times to pass in different pip flags.
As an example passing in &#8211;extra-pip-arg &#8220;&#8211;no-compile&#8221; to the
override_dh_virtualenv section of the debian/rules file will
disable the generation of pyc files.</p>
</dd></dl>

<dl class="cmdoption">
<dt id="cmdoption--requirements">
<code class="descname">--requirements</code><code class="descclassname"> &lt;REQUIREMENTS FILE&gt;</code><a class="headerlink" href="#cmdoption--requirements" title="Permalink to this definition"></a></dt>
<dd><p>Use a different requirements file when installing. Some packages
such as <a class="reference external" href="http://docs.openstack.org/developer/pbr/">pbr</a> expect
the <code class="docutils literal"><span class="pre">requirements.txt</span></code> file to be a simple list of requirements
that can be copied verbatim into the <code class="docutils literal"><span class="pre">install_requires</span></code>
list. This command option allows specifying a different
<code class="docutils literal"><span class="pre">requirements.txt</span></code> file that may include pip specific flags such
as <code class="docutils literal"><span class="pre">-i</span></code>, <code class="docutils literal"><span class="pre">-r-</span></code> and <code class="docutils literal"><span class="pre">-e</span></code>.</p>
</dd></dl>

<dl class="cmdoption">
<dt id="cmdoption--setuptools">
<code class="descname">--setuptools</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--setuptools" title="Permalink to this definition"></a></dt>
<dd><p>Use setuptools instead of distribute in the virtualenv</p>
</dd></dl>

<dl class="cmdoption">
<dt id="cmdoption--no-test">
<code class="descname">--no-test</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--no-test" title="Permalink to this definition"></a></dt>
<dd><p>Skip running <code class="docutils literal"><span class="pre">python</span> <span class="pre">setup.py</span> <span class="pre">test</span></code> after dependencies and the
package is installed. This is useful if the Python code is packaged
using distutils and not setuptools.</p>
</dd></dl>

<dl class="cmdoption">
<dt id="cmdoption--python">
<code class="descname">--python</code><code class="descclassname"> &lt;path&gt;</code><a class="headerlink" href="#cmdoption--python" title="Permalink to this definition"></a></dt>
<dd><p>Use a specific Python interpreter found in <code class="docutils literal"><span class="pre">path</span></code> as the
interpreter for the virtualenv. Default is to use the system
default, usually <code class="docutils literal"><span class="pre">/usr/bin/python</span></code>.</p>
</dd></dl>

<dl class="cmdoption">
<dt id="cmdoption--builtin-venv">
<code class="descname">--builtin-venv</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--builtin-venv" title="Permalink to this definition"></a></dt>
<dd><p>Enable the use of the build-in <code class="docutils literal"><span class="pre">venv</span></code> module, i.e. use <code class="docutils literal"><span class="pre">python</span>
<span class="pre">-m</span> <span class="pre">venv</span></code> to create the virtualenv. For this to work, requires
Python 3.4 or later to be used, e.g. by using the option <code class="docutils literal"><span class="pre">--python</span>
<span class="pre">/usr/bin/python3.4</span></code>. (Python 3.3 has the <code class="docutils literal"><span class="pre">venv</span></code> module, but
virtualenvs created with Python 3.3 are not bootstrapped with
setuptools or pip.)</p>
</dd></dl>

<dl class="cmdoption">
<dt id="cmdoption-S">
<span id="cmdoption--use-system-packages"></span><code class="descname">-S</code><code class="descclassname"></code><code class="descclassname">, </code><code class="descname">--use-system-packages</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption-S" title="Permalink to this definition"></a></dt>
<dd><p>Enable the use of system site-packages in the created virtualenv
by passing the <code class="docutils literal"><span class="pre">--system-site-packages</span></code> flag to <code class="docutils literal"><span class="pre">virtualenv</span></code>.</p>
</dd></dl>

<dl class="cmdoption">
<dt id="cmdoption--skip-install">
<code class="descname">--skip-install</code><code class="descclassname"></code><a class="headerlink" href="#cmdoption--skip-install" title="Permalink to this definition"></a></dt>
<dd><p>Skip running <code class="docutils literal"><span class="pre">pip</span> <span class="pre">install</span> <span class="pre">.</span></code> after dependencies have been
installed. This will result in anything specified in setup.py being
ignored. If this package is intended to install a virtualenv
and a program that uses the supplied virtualenv, it is up to
the user to ensure that if setup.py exists, any installation logic
or dependencies contained therein are handled.</p>
<p>This option is useful for web application deployments where the
package is expected contain the virtual environment to support
an application which itself may be installed via some other means
&#8211; typically, by the packages <code class="docutils literal"><span class="pre">./debian/&lt;packagename&gt;.install</span></code>
file, possibly into a directory structure unrelated to the location
of the virtual environment.</p>
</dd></dl>

</div>
<div class="section" id="advanced-usage">
<h2>Advanced usage<a class="headerlink" href="#advanced-usage" title="Permalink to this headline"></a></h2>
<p>To provide command line options to <code class="docutils literal"><span class="pre">dh_virtualenv</span></code> sequence the
override mechanism of the debhelper is the best tool.</p>
<p>Following <code class="docutils literal"><span class="pre">debian/rules</span></code> will provide <em>http://example.com</em> as
additional Python Package Index URI:</p>
<div class="highlight-make"><div class="highlight"><pre><span class="c">#!/usr/bin/make -f</span>

<span class="nf">%</span><span class="o">:</span>
      dh <span class="nv">$@</span> --with python-virtualenv

<span class="nf">override_dh_virtualenv</span><span class="o">:</span>
      dh_virtualenv --extra-index-url http://example.com
</pre></div>
</div>
</div>
<div class="section" id="experimental-buildsystem-support">
<h2>Experimental buildsystem support<a class="headerlink" href="#experimental-buildsystem-support" title="Permalink to this headline"></a></h2>
<p><strong>Important</strong>: Following chapters describe a completely experimental
functionality of dh-virtualenv.</p>
<p>Starting with version 0.9 of dh-virtualenv, there is a buildsystem alternative.
The main difference in use is that instead of the <code class="docutils literal"><span class="pre">--with</span> <span class="pre">python-virtualenv</span></code>
option, <code class="docutils literal"><span class="pre">--buildsystem=dh_virtualenv</span></code> is passed to debhelper. The <code class="docutils literal"><span class="pre">debian</span> <span class="pre">rules</span></code>
file should look like this:</p>
<div class="highlight-make"><div class="highlight"><pre><span class="c">#!/usr/bin/make -f</span>

<span class="nf">%</span><span class="o">:</span>
        dh <span class="nv">$@</span> --buildsystem<span class="o">=</span>dh_virtualenv
</pre></div>
</div>
<p>Using the buildsystem instead of the part of the sequence (in other
words, instead of the <code class="docutils literal"><span class="pre">--with</span> <span class="pre">python-virtualenv</span></code>) one can get more
flexibility into the build process.</p>
<p>Flexibility comes from the fact that buildsystem will have individual
steps for configure, build, test and install and those can be
overridden by adding <code class="docutils literal"><span class="pre">override_dh_auto_&lt;STEP&gt;</span></code> target into the
<code class="docutils literal"><span class="pre">debian/rules</span></code> file. For example:</p>
<div class="highlight-make"><div class="highlight"><pre><span class="c">#!/usr/bin/make -f</span>

<span class="nf">%</span><span class="o">:</span>
        dh <span class="nv">$@</span> --buildsystem<span class="o">=</span>dh_virtualenv

<span class="nf">override_dh_auto_test</span><span class="o">:</span>
        py.test <span class="nb">test</span>/
</pre></div>
</div>
<p>In addition the separation of build and install steps makes it
possible to use <code class="docutils literal"><span class="pre">debian/install</span></code> files to include built files into
the Debian package. This is not possible with the sequencer addition.</p>
<p>The build system honors the <code class="docutils literal"><span class="pre">DH_VIRTUALENV_INSTALL_ROOT</span></code> environment
variable. Arguments can be passed to virtualenv by setting
<code class="docutils literal"><span class="pre">DH_VIRTUALENV_ARGUMENTS</span></code>. For example:</p>
<div class="highlight-make"><div class="highlight"><pre><span class="k">export </span><span class="nv">DH_VIRTUALENV_ARGUMENTS</span><span class="o">=</span>--no-site-packages --always-copy
</pre></div>
</div>
<p>The default is to create the virtual environment with <code class="docutils literal"><span class="pre">--no-site-packages</span></code>.</p>
<div class="section" id="known-incompabilities-of-the-buildsystem">
<h3>Known incompabilities of the buildsystem<a class="headerlink" href="#known-incompabilities-of-the-buildsystem" title="Permalink to this headline"></a></h3>
<p>This section defines the known incompabilities with the sequencer
approach. There are no guarantees that these all get addressed, but
most of them, if not all, probably will.</p>
<ul class="simple">
<li>No custom Python interpreter supported</li>
<li><code class="docutils literal"><span class="pre">Pyvenv</span></code> of Python 3.x is not supported</li>
<li>No custom arguments outside requirements.txt can be passed to
<code class="docutils literal"><span class="pre">pip</span></code></li>
</ul>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Building packages with dh-virtualenv</a><ul>
<li><a class="reference internal" href="#simple-usecase">Simple usecase</a></li>
<li><a class="reference internal" href="#command-line-options">Command line options</a></li>
<li><a class="reference internal" href="#advanced-usage">Advanced usage</a></li>
<li><a class="reference internal" href="#experimental-buildsystem-support">Experimental buildsystem support</a><ul>
<li><a class="reference internal" href="#known-incompabilities-of-the-buildsystem">Known incompabilities of the buildsystem</a></li>
</ul>
</li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="tutorial.html"
                        title="previous chapter">Tutorial</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="_sources/usage.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" />
      <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" role="navigation" aria-label="related navigation">
      <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="tutorial.html" title="Tutorial"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">dh-virtualenv 0.11 documentation</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &copy; Copyright 2013-2014 Spotify AB.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.3.
    </div>
  </body>
</html>