/usr/share/doc/python-autopilot/html/_modules/autopilot/_info.html is in python-autopilot 1.4.1+15.10.20150911-0ubuntu2.
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 | <!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>autopilot._info — Autopilot 1.4.1+15.10.20150911-0 documentation</title>
<link rel="stylesheet" href="../../_static/nature.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/otto.css" type="text/css" />
<link rel="stylesheet" href="../../_static/centertext.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '1.4.1+15.10.20150911-0',
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="Autopilot 1.4.1+15.10.20150911-0 documentation" href="../../index.html" />
<link rel="up" title="Module code" href="../index.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="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../../index.html">Autopilot 1.4.1+15.10.20150911-0 documentation</a> »</li>
<li class="nav-item nav-item-1"><a href="../index.html" accesskey="U">Module code</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<h1>Source code for autopilot._info</h1><div class="highlight"><pre>
<span class="c"># -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-</span>
<span class="c">#</span>
<span class="c"># Autopilot Functional Test Tool</span>
<span class="c"># Copyright (C) 2012-2013 Canonical</span>
<span class="c">#</span>
<span class="c"># This program is free software: you can redistribute it and/or modify</span>
<span class="c"># it under the terms of the GNU General Public License as published by</span>
<span class="c"># the Free Software Foundation, either version 3 of the License, or</span>
<span class="c"># (at your option) any later version.</span>
<span class="c">#</span>
<span class="c"># This program is distributed in the hope that it will be useful,</span>
<span class="c"># but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<span class="c"># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
<span class="c"># GNU General Public License for more details.</span>
<span class="c">#</span>
<span class="c"># You should have received a copy of the GNU General Public License</span>
<span class="c"># along with this program. If not, see <http://www.gnu.org/licenses/>.</span>
<span class="c">#</span>
<span class="sd">"""Provide version and package availibility information for autopilot."""</span>
<span class="kn">import</span> <span class="nn">subprocess</span>
<span class="n">__all__</span> <span class="o">=</span> <span class="p">[</span>
<span class="s">'get_version_string'</span><span class="p">,</span>
<span class="s">'have_vis'</span><span class="p">,</span>
<span class="s">'version'</span><span class="p">,</span>
<span class="p">]</span>
<span class="n">version</span> <span class="o">=</span> <span class="s">'1.4.0'</span>
<div class="viewcode-block" id="have_vis"><a class="viewcode-back" href="../../api/autopilot.html#autopilot.have_vis">[docs]</a><span class="k">def</span> <span class="nf">have_vis</span><span class="p">():</span>
<span class="sd">"""Return true if the vis package is installed."""</span>
<span class="k">try</span><span class="p">:</span>
<span class="kn">from</span> <span class="nn">autopilot.vis</span> <span class="kn">import</span> <span class="n">vis_main</span> <span class="c"># flake8: noqa</span>
<span class="k">return</span> <span class="bp">True</span>
<span class="k">except</span> <span class="ne">ImportError</span><span class="p">:</span>
<span class="k">return</span> <span class="bp">False</span></div>
<div class="viewcode-block" id="get_version_string"><a class="viewcode-back" href="../../api/autopilot.html#autopilot.get_version_string">[docs]</a><span class="k">def</span> <span class="nf">get_version_string</span><span class="p">():</span>
<span class="sd">"""Return the autopilot source and package versions."""</span>
<span class="n">version_string</span> <span class="o">=</span> <span class="s">"Autopilot Source Version: "</span> <span class="o">+</span> <span class="n">_get_source_version</span><span class="p">()</span>
<span class="n">pkg_version</span> <span class="o">=</span> <span class="n">_get_package_version</span><span class="p">()</span>
<span class="k">if</span> <span class="n">pkg_version</span><span class="p">:</span>
<span class="n">version_string</span> <span class="o">+=</span> <span class="s">"</span><span class="se">\n</span><span class="s">Autopilot Package Version: "</span> <span class="o">+</span> <span class="n">pkg_version</span>
<span class="k">return</span> <span class="n">version_string</span></div>
<span class="k">def</span> <span class="nf">_get_source_version</span><span class="p">():</span>
<span class="k">return</span> <span class="n">version</span>
<span class="k">def</span> <span class="nf">_get_package_version</span><span class="p">():</span>
<span class="sd">"""Get the version of the currently installed package version, or None.</span>
<span class="sd"> Only returns the package version if the package is installed, *and* we seem</span>
<span class="sd"> to be running the system-wide installed code.</span>
<span class="sd"> """</span>
<span class="k">if</span> <span class="n">_running_in_system</span><span class="p">():</span>
<span class="k">return</span> <span class="n">_get_package_installed_version</span><span class="p">()</span>
<span class="k">return</span> <span class="bp">None</span>
<span class="k">def</span> <span class="nf">_running_in_system</span><span class="p">():</span>
<span class="sd">"""Return True if we're running autopilot from the system installation</span>
<span class="sd"> dir."""</span>
<span class="k">return</span> <span class="n">__file__</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s">'/usr/'</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">_get_package_installed_version</span><span class="p">():</span>
<span class="sd">"""Get the version string of the system-wide installed package, or None if</span>
<span class="sd"> it is not installed.</span>
<span class="sd"> """</span>
<span class="k">try</span><span class="p">:</span>
<span class="k">return</span> <span class="n">subprocess</span><span class="o">.</span><span class="n">check_output</span><span class="p">(</span>
<span class="p">[</span>
<span class="s">"dpkg-query"</span><span class="p">,</span>
<span class="s">"--showformat"</span><span class="p">,</span>
<span class="s">"${Version}"</span><span class="p">,</span>
<span class="s">"--show"</span><span class="p">,</span>
<span class="s">"python-autopilot"</span><span class="p">,</span>
<span class="p">],</span>
<span class="n">universal_newlines</span><span class="o">=</span><span class="bp">True</span>
<span class="p">)</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
<span class="k">except</span> <span class="n">subprocess</span><span class="o">.</span><span class="n">CalledProcessError</span><span class="p">:</span>
<span class="k">return</span> <span class="bp">None</span>
</pre></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../../index.html">
<img class="logo" src="../../_static/otto-64.png" alt="Logo"/>
</a></p>
<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="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../../index.html">Autopilot 1.4.1+15.10.20150911-0 documentation</a> »</li>
<li class="nav-item nav-item-1"><a href="../index.html" >Module code</a> »</li>
</ul>
</div>
<div class="footer">
<div class=center_text>
<a href="../../faq/contribute.html">Learn how you can contribute!</a> / <a href="https://bugs.launchpad.net/autopilot/+filebug">File a bug</a>
<br/>
</div>
© Copyright 2012-2013, Canonical.
</div>
</body>
</html>
|