/usr/share/doc/python-guiqwt/html/disthelpers.html is in python-guiqwt 2.3.1-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 | <!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>Making executable Windows programs — guiqwt 2.3.1 documentation</title>
<link rel="stylesheet" href="_static/sphinxdoc.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.3.1',
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="shortcut icon" href="_static/favicon.ico"/>
<link rel="top" title="guiqwt 2.3.1 documentation" href="index.html" />
<link rel="next" title="GUIQwt reference" href="reference.html" />
<link rel="prev" title="Sift, the Signal and Image Filtering Tool" href="sift.html" />
</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="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="reference.html" title="GUIQwt reference"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="sift.html" title="Sift, the Signal and Image Filtering Tool"
accesskey="P">previous</a> |</li>
<li><a href="index.html">guiqwt 2.3.1 documentation</a> »</li>
</ul>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="index.html">
<img class="logo" src="_static/guiqwt.png" alt="Logo"/>
</a></p>
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Making executable Windows programs</a><ul>
<li><a class="reference internal" href="#example">Example</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="sift.html"
title="previous chapter">Sift, the Signal and Image Filtering Tool</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="reference.html"
title="next chapter">GUIQwt reference</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/disthelpers.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" />
<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="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="making-executable-windows-programs">
<h1>Making executable Windows programs<a class="headerlink" href="#making-executable-windows-programs" title="Permalink to this headline">¶</a></h1>
<p>The <cite>py2exe</cite> Python library is an extension to Python <cite>distutils</cite> module which
converts Python scripts into executable Windows programs, able to run without
requiring a Python installation.</p>
<p>Making such an executable program may be a non trivial task when the script
dependencies include libraries with data or extensions, such as <cite>PyQt4</cite> or
<cite>guidata</cite> and <cite>guiqwt</cite>. This task has been considerably simplified thanks to
the helper functions provided by <tt class="xref py py-mod docutils literal"><span class="pre">guidata.disthelpers</span></tt>.</p>
<div class="section" id="example">
<h2>Example<a class="headerlink" href="#example" title="Permalink to this headline">¶</a></h2>
<p>This example is included in <cite>guiqwt</cite> source package (see the
<tt class="docutils literal"><span class="pre">py2exe_example</span></tt> directory).</p>
<p>Simple example script named <tt class="docutils literal"><span class="pre">simpledialog.pyw</span></tt> which is based on <cite>guiqwt</cite>
(and implicitely on <cite>guidata</cite>):</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">guiqwt.plot</span> <span class="kn">import</span> <span class="n">ImageDialog</span>
<span class="kn">from</span> <span class="nn">guiqwt.builder</span> <span class="kn">import</span> <span class="n">make</span>
<span class="k">class</span> <span class="nc">VerySimpleDialog</span><span class="p">(</span><span class="n">ImageDialog</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">set_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
<span class="n">plot</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_plot</span><span class="p">()</span>
<span class="n">item</span> <span class="o">=</span> <span class="n">make</span><span class="o">.</span><span class="n">trimage</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
<span class="n">plot</span><span class="o">.</span><span class="n">add_item</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="n">z</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span>
<span class="n">plot</span><span class="o">.</span><span class="n">set_active_item</span><span class="p">(</span><span class="n">item</span><span class="p">)</span>
<span class="n">plot</span><span class="o">.</span><span class="n">replot</span><span class="p">()</span>
<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">"__main__"</span><span class="p">:</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="kn">as</span> <span class="nn">np</span>
<span class="kn">from</span> <span class="nn">guidata</span> <span class="kn">import</span> <span class="n">qapplication</span>
<span class="n">qapplication</span><span class="p">()</span>
<span class="n">dlg</span> <span class="o">=</span> <span class="n">VerySimpleDialog</span><span class="p">()</span>
<span class="n">dlg</span><span class="o">.</span><span class="n">set_data</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">rand</span><span class="p">(</span><span class="mi">100</span><span class="p">,</span> <span class="mi">100</span><span class="p">))</span>
<span class="n">dlg</span><span class="o">.</span><span class="n">exec_</span><span class="p">()</span>
</pre></div>
</div>
<p>The <tt class="docutils literal"><span class="pre">setup.py</span></tt> script may be written as the following:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">distutils.core</span> <span class="kn">import</span> <span class="n">setup</span>
<span class="kn">import</span> <span class="nn">py2exe</span> <span class="c"># Patching distutils setup</span>
<span class="kn">from</span> <span class="nn">guidata.disthelpers</span> <span class="kn">import</span> <span class="p">(</span><span class="n">remove_build_dist</span><span class="p">,</span> <span class="n">get_default_excludes</span><span class="p">,</span>
<span class="n">get_default_dll_excludes</span><span class="p">,</span> <span class="n">create_vs2008_data_files</span><span class="p">,</span>
<span class="n">add_modules</span><span class="p">)</span>
<span class="c"># Removing old build/dist folders</span>
<span class="n">remove_build_dist</span><span class="p">()</span>
<span class="c"># Including/excluding DLLs and Python modules</span>
<span class="n">EXCLUDES</span> <span class="o">=</span> <span class="n">get_default_excludes</span><span class="p">()</span>
<span class="n">INCLUDES</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">DLL_EXCLUDES</span> <span class="o">=</span> <span class="n">get_default_dll_excludes</span><span class="p">()</span>
<span class="n">DATA_FILES</span> <span class="o">=</span> <span class="n">create_vs2008_data_files</span><span class="p">()</span>
<span class="c"># Configuring/including Python modules</span>
<span class="n">add_modules</span><span class="p">((</span><span class="s">'PyQt4'</span><span class="p">,</span> <span class="s">'guidata'</span><span class="p">,</span> <span class="s">'guiqwt'</span><span class="p">),</span> <span class="n">DATA_FILES</span><span class="p">,</span> <span class="n">INCLUDES</span><span class="p">,</span> <span class="n">EXCLUDES</span><span class="p">)</span>
<span class="n">setup</span><span class="p">(</span>
<span class="n">options</span><span class="o">=</span><span class="p">{</span>
<span class="s">"py2exe"</span><span class="p">:</span> <span class="p">{</span><span class="s">"compressed"</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span> <span class="s">"optimize"</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span> <span class="s">'bundle_files'</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
<span class="s">"includes"</span><span class="p">:</span> <span class="n">INCLUDES</span><span class="p">,</span> <span class="s">"excludes"</span><span class="p">:</span> <span class="n">EXCLUDES</span><span class="p">,</span>
<span class="s">"dll_excludes"</span><span class="p">:</span> <span class="n">DLL_EXCLUDES</span><span class="p">,</span>
<span class="s">"dist_dir"</span><span class="p">:</span> <span class="s">"dist"</span><span class="p">,},</span>
<span class="p">},</span>
<span class="n">data_files</span><span class="o">=</span><span class="n">DATA_FILES</span><span class="p">,</span>
<span class="n">windows</span><span class="o">=</span><span class="p">[{</span>
<span class="s">"script"</span><span class="p">:</span> <span class="s">"simpledialog.pyw"</span><span class="p">,</span>
<span class="s">"dest_base"</span><span class="p">:</span> <span class="s">"simpledialog"</span><span class="p">,</span>
<span class="s">"version"</span><span class="p">:</span> <span class="s">"1.0.0"</span><span class="p">,</span>
<span class="s">"company_name"</span><span class="p">:</span> <span class="s">u"CEA"</span><span class="p">,</span>
<span class="s">"copyright"</span><span class="p">:</span> <span class="s">u"Copyright © 2010 CEA - Pierre Raybaut"</span><span class="p">,</span>
<span class="s">"name"</span><span class="p">:</span> <span class="s">"Simple dialog box"</span><span class="p">,</span>
<span class="s">"description"</span><span class="p">:</span> <span class="s">"Simple dialog box"</span><span class="p">,</span>
<span class="p">},],</span>
<span class="n">zipfile</span> <span class="o">=</span> <span class="bp">None</span><span class="p">,</span>
<span class="p">)</span>
</pre></div>
</div>
<dl class="docutils">
<dt>Make the Windows executable program with the following command:</dt>
<dd><cite>python setup.py py2exe</cite></dd>
</dl>
</div>
</div>
</div>
</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="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="reference.html" title="GUIQwt reference"
>next</a> |</li>
<li class="right" >
<a href="sift.html" title="Sift, the Signal and Image Filtering Tool"
>previous</a> |</li>
<li><a href="index.html">guiqwt 2.3.1 documentation</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2009-2013, CEA - Commissariat à l'Energie Atomique et aux Energies Alternatives.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html>
|