/usr/share/doc/python-apsw/html/build.html is in python-apsw-doc 3.16.2-r1-2build2.
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 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 | <!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 — APSW 3.16.2-r1 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: '3.16.2-r1',
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="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="copyright" title="Copyright" href="copyright.html" />
<link rel="top" title="APSW 3.16.2-r1 documentation" href="index.html" />
<link rel="next" title="Extensions" href="extensions.html" />
<link rel="prev" title="Download" href="download.html" />
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-26815066-1']);
_gaq.push(['_trackPageview']);
</script>
</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="right" >
<a href="extensions.html" title="Extensions"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="download.html" title="Download"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">APSW 3.16.2-r1 documentation</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="building">
<span id="id1"></span><h1>Building<a class="headerlink" href="#building" title="Permalink to this headline">¶</a></h1>
<div class="section" id="setup-py">
<h2>setup.py<a class="headerlink" href="#setup-py" title="Permalink to this headline">¶</a></h2>
<p>Short story: You run <code class="file docutils literal"><span class="pre">setup.py</span></code> but you should ideally follow
the <a class="reference internal" href="#recommended-build"><span class="std std-ref">recommended way</span></a> which will also fetch
needed components for you.</p>
<table border="1" class="docutils">
<colgroup>
<col width="46%" />
<col width="54%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Command</th>
<th class="head">Result</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><div class="first last line-block">
<div class="line">python setup.py install test</div>
</div>
</td>
<td>Compiles APSW with default Python compiler, installs it into Python
site library directory and then runs the test suite.</td>
</tr>
<tr class="row-odd"><td><div class="first last line-block">
<div class="line">python setup.py install <code class="xref std std-option docutils literal"><span class="pre">--user</span></code></div>
</div>
</td>
<td>(Python 2.6+, 3). Compiles APSW with default Python
compiler and installs it into a subdirectory of your home directory.
See <span class="target" id="index-0"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-0370"><strong>PEP 370</strong></a> for more details.</td>
</tr>
<tr class="row-even"><td><div class="first last line-block">
<div class="line">python setup.py build <code class="xref std std-option docutils literal"><span class="pre">--compile=mingw32</span></code> install</div>
</div>
</td>
<td>On Windows this will use the
<a class="reference external" href="http://www.gnu.org/philosophy/free-sw.html">free</a>
<a class="reference external" href="http://mingw.org">MinGW compiler</a> instead of the
Microsoft compilers.</td>
</tr>
<tr class="row-odd"><td><div class="first last line-block">
<div class="line">python setup.py build_ext <code class="xref std std-option docutils literal"><span class="pre">--force</span></code>
<code class="xref std std-option docutils literal"><span class="pre">--inplace</span></code> test</div>
</div>
</td>
<td>Compiles the extension but doesn’t install it. The resulting file
will be in the current directory named apsw.so (Unix/Mac) or
apsw.pyd (Windows). The test suite is then run. (Note on recent versions
of CPython the extension filenames may be more complicated due to
<span class="target" id="index-1"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-3149"><strong>PEP 3149</strong></a>.)</td>
</tr>
<tr class="row-even"><td><div class="first last line-block">
<div class="line">python setup.py build <code class="xref std std-option docutils literal"><span class="pre">--debug</span></code> install</div>
</div>
</td>
<td>Compiles APSW with debug information. This also turns on <a class="reference external" href="http://en.wikipedia.org/wiki/Assert.h">assertions</a>
in APSW that double check the code assumptions. If you are using the
SQLite amalgamation then assertions are turned on in that too. Note
that this will considerably slow down APSW and SQLite.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="additional-setup-py-flags">
<span id="setup-py-flags"></span><h2>Additional <code class="file docutils literal"><span class="pre">setup.py</span></code> flags<a class="headerlink" href="#additional-setup-py-flags" title="Permalink to this headline">¶</a></h2>
<p>There are a number of APSW specific flags to commands you can specify.</p>
<div class="section" id="fetch">
<h3>fetch<a class="headerlink" href="#fetch" title="Permalink to this headline">¶</a></h3>
<p><code class="file docutils literal"><span class="pre">setup.py</span></code> can automatically fetch SQLite and other optional
components. You can set the environment variable <code class="xref py py-const docutils literal"><span class="pre">http_proxy</span></code>
to control proxy usage for the download. <strong>Note</strong> the files downloaded
are modified from their originals to ensure various names do not
clash, adjust them to the download platform and to graft them cleanly
into the APSW module. You should not commit them to source code
control systems (download seperately if you need clean files).</p>
<p>If any files are downloaded then the build step will automatically use
them. This still applies when you do later builds without
re-fetching.</p>
<blockquote>
<div><div class="line-block">
<div class="line">python setup.py fetch <em>options</em></div>
</div>
</div></blockquote>
<table border="1" class="docutils">
<colgroup>
<col width="32%" />
<col width="68%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">fetch flag</th>
<th class="head">Result</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><div class="first last line-block">
<div class="line"><code class="xref std std-option docutils literal"><span class="pre">--version=VERSION</span></code></div>
</div>
</td>
<td><p class="first">By default the <a class="reference external" href="https://sqlite.org/download.html">SQLite download page</a> is
consulted to find the current SQLite version
which you can override using this flag.</p>
<div class="last admonition note">
<p class="first admonition-title">Note</p>
<p class="last">You can also specify <cite>fossil</cite> as the version
and the current development version from <a class="reference external" href="https://sqlite.org/src/timeline">SQLite’s source tracking system</a> will be used. (The system is named
<a class="reference external" href="http://www.fossil-scm.org">Fossil</a>.) Note that checksums can’t be checked
for fossil. You will also need TCL and make installed for the amalgamation to
build as well as several other common Unix tools. (ie this is very unlikely to
work on Windows.)</p>
</div>
</td>
</tr>
<tr class="row-odd"><td><div class="first last line-block">
<div class="line"><code class="xref std std-option docutils literal"><span class="pre">--missing-checksum-ok</span></code></div>
</div>
</td>
<td>Allows setup to continue if the <a class="reference internal" href="#fetch-checksums"><span class="std std-ref">checksum</span></a> is missing.</td>
</tr>
<tr class="row-even"><td><div class="first last line-block">
<div class="line"><code class="xref std std-option docutils literal"><span class="pre">--all</span></code></div>
</div>
</td>
<td>Gets all components listed below.</td>
</tr>
<tr class="row-odd"><td><div class="first last line-block">
<div class="line"><code class="xref std std-option docutils literal"><span class="pre">--sqlite</span></code></div>
</div>
</td>
<td>Automatically downloads the <a class="reference external" href="https://sqlite.org/amalgamation.html">SQLite amalgamation</a>. The amalgamation is the
preferred way to use SQLite as you have total control over what components are
included or excluded (see below) and have no dependencies on any existing
libraries on your developer or deployment machines. The amalgamation includes the
fts3/4/5, rtree, json1 and icu extensions. On non-Windows platforms, any existing
<code class="file docutils literal"><span class="pre">sqlite3/</span></code> directory will be erased and the downloaded code placed in a newly
created <code class="file docutils literal"><span class="pre">sqlite3/</span></code> directory.</td>
</tr>
</tbody>
</table>
<div class="admonition note" id="fetch-checksums">
<p class="first admonition-title">Note</p>
<p>The SQLite downloads are not <a class="reference external" href="http://en.wikipedia.org/wiki/Digital_signature">digitally signed</a> which means you
have no way of verifying they were produced by the SQLite team or
were not modified between the SQLite servers and your computer.</p>
<p>Consequently APSW ships with a <a class="reference external" href="https://github.com/rogerbinns/apsw/blob/master/checksums">checksums file</a>
that includes checksums for the various SQLite downloads. If the
download does not match the checksum then it is rejected and an
error occurs.</p>
<p>The SQLite download page is not checksummed, so in theory a bad guy
could modify it to point at a malicious download version instead.
(setup only uses the page to determine the current version number -
the SQLite download site URL is hard coded.)</p>
<p class="last">If the URL is not listed in the checksums file then setup aborts.
You can use <code class="xref std std-option docutils literal"><span class="pre">--missing-checksum-ok</span></code> to continue. You are
recommended instead to update the checksums file with the
correct information.</p>
</div>
<div class="admonition note" id="fetch-configure">
<p class="first admonition-title">Note</p>
<p>(This note only applies to non-Windows platforms.) By default the
amalgamation will work on your platform. It detects
the operating system (and compiler if relevant) and uses the
appropriate APIs. However it then only uses the oldest known
working APIs. For example it will use the <em>sleep</em> system call.
More recent APIs may exist but the amalgamation needs to be told
they exist. As an example <em>sleep</em> can only sleep in increments of
one second while the <em>usleep</em> system call can sleep in increments of
one microsecond. The default SQLite busy handler does small sleeps
(eg 1/50th of a second) backing off as needed. If <em>sleep</em> is used
then those will all be a minimum of a second. A second example is
that the traditional APIs for getting time information are not
re-entrant and cannot be used concurrently from multiple threads.
Consequently SQLite has mutexes to ensure that concurrent calls do
not happen. However you can tell it you have more recent re-entrant
versions of the calls and it won’t need to bother with the mutexes.</p>
<p>After fetching the amalgamation, setup automatically determines what
new APIs you have by running the <code class="file docutils literal"><span class="pre">configure</span></code> script that comes
with SQLite and noting the output. The information is placed in
<code class="file docutils literal"><span class="pre">sqlite3/sqlite3config.h</span></code>. The build stage will automatically
take note of this as needed.</p>
<p class="last">If you get the fossil version then the configure script does not
work. Instead the fetch will save and re-use any pre-existing
<code class="file docutils literal"><span class="pre">sqlite3/sqlite3config.h</span></code>.</p>
</div>
</div>
<div class="section" id="build-build-ext">
<span id="setup-build-flags"></span><h3>build/build_ext<a class="headerlink" href="#build-build-ext" title="Permalink to this headline">¶</a></h3>
<p>You can enable or omit certain functionality by specifying flags to
the build and/or build_ext commands of <code class="file docutils literal"><span class="pre">setup.py</span></code>.</p>
<blockquote>
<div><div class="line-block">
<div class="line">python setup.py build <em>options</em></div>
</div>
</div></blockquote>
<p>Note that the options do not accumulate. If you want to specify multiple enables or omits then you
need to give the flag once and giving a comma seperated list. For example:</p>
<blockquote>
<div><div class="line-block">
<div class="line">python setup.py build <code class="xref std std-option docutils literal"><span class="pre">--enable=fts3,fts3_parenthesis,rtree,icu</span></code></div>
</div>
</div></blockquote>
<table border="1" class="docutils">
<colgroup>
<col width="32%" />
<col width="68%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">build/build_ext flag</th>
<th class="head">Result</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><div class="first last line-block">
<div class="line"><code class="xref std std-option docutils literal"><span class="pre">--enable-all-extensions</span></code></div>
</div>
</td>
<td>Enables the STAT4, FTS3/4, RTree, and ICU extensions if <em>icu-config</em> is on your path</td>
</tr>
<tr class="row-odd"><td><div class="first last line-block">
<div class="line"><code class="xref std std-option docutils literal"><span class="pre">--enable=fts3</span></code></div>
<div class="line"><code class="xref std std-option docutils literal"><span class="pre">--enable=fts4</span></code></div>
<div class="line"><code class="xref std std-option docutils literal"><span class="pre">--enable=fts5</span></code></div>
</div>
</td>
<td>Enables the <a class="reference internal" href="extensions.html#ext-fts3"><span class="std std-ref">full text search extension</span></a>.
This flag only helps when using the amalgamation. If not using the
amalgamation then you need to seperately ensure fts3/4/5 is enabled in the SQLite
install. You are likely to want the <a class="reference external" href="https://sqlite.org/compile.html#enable_fts3_parenthesis">parenthesis option</a> on unless you have
legacy code (<cite>–enable-all-extensions</cite> turns it on).</td>
</tr>
<tr class="row-even"><td><div class="first last line-block">
<div class="line"><code class="xref std std-option docutils literal"><span class="pre">--enable=rtree</span></code></div>
</div>
</td>
<td>Enables the <a class="reference internal" href="extensions.html#ext-rtree"><span class="std std-ref">spatial table extension</span></a>.
This flag only helps when using the amalgamation. If not using the
amalgamation then you need to seperately ensure rtree is enabled in the SQLite
install.</td>
</tr>
<tr class="row-odd"><td><div class="first last line-block">
<div class="line"><code class="xref std std-option docutils literal"><span class="pre">--enable=icu</span></code></div>
</div>
</td>
<td>Enables the <a class="reference internal" href="extensions.html#ext-icu"><span class="std std-ref">International Components for Unicode extension</span></a>.
Note that you must have the ICU libraries on your machine which setup will
automatically try to find using <code class="file docutils literal"><span class="pre">icu-config</span></code>.
This flag only helps when using the amalgamation. If not using the
amalgamation then you need to seperately ensure ICU is enabled in the SQLite
install.</td>
</tr>
<tr class="row-even"><td><div class="first last line-block">
<div class="line"><code class="xref std std-option docutils literal"><span class="pre">--omit=ITEM</span></code></div>
</div>
</td>
<td>Causes various functionality to be omitted. For example
<code class="xref std std-option docutils literal"><span class="pre">--omit=load_extension</span></code> will omit code to do with loading extensions. If
using the amalgamation then this will omit the functionality from APSW and
SQLite, otherwise the functionality will only be omitted from APSW (ie the code
will still be in SQLite, APSW just won’t call it). In almost all cases you will need
to regenerate the SQLite source because the omits also alter the generated SQL
parser. See <a class="reference external" href="https://sqlite.org/compile.html#omitfeatures">the relevant SQLite documentation</a>.</td>
</tr>
</tbody>
</table>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Extension loading is enabled by default when using the amalgamation
and disabled when using existing libraries as this most closely
matches current practise. Use <code class="xref std std-option docutils literal"><span class="pre">--omit=load_extension</span></code> or
<code class="xref std std-option docutils literal"><span class="pre">--enable=load_extension</span></code> to explicity disable/enable the
extension loading code.</p>
</div>
</div>
</div>
<div class="section" id="finding-sqlite-3">
<h2>Finding SQLite 3<a class="headerlink" href="#finding-sqlite-3" title="Permalink to this headline">¶</a></h2>
<p>SQLite 3 is needed during the build process. If you specify
<code class="xref std std-option docutils literal"><span class="pre">fetch</span> <span class="pre">--sqlite</span></code> to the <code class="file docutils literal"><span class="pre">setup.py</span></code> command line
then it will automatically fetch the current version of the SQLite
amalgamation. (The current version is determined by parsing the
<a class="reference external" href="https://sqlite.org/download.html">SQLite download page</a>). You
can manually specify the version, for example
<code class="xref std std-option docutils literal"><span class="pre">fetch</span> <span class="pre">--sqlite</span> <span class="pre">--version=3.7.4</span></code>.</p>
<p>These methods are tried in order:</p>
<blockquote>
<div><p><a class="reference external" href="https://sqlite.org/amalgamation.html">Amalgamation</a></p>
<blockquote>
<div>The file <code class="file docutils literal"><span class="pre">sqlite3.c</span></code> and then <code class="file docutils literal"><span class="pre">sqlite3/sqlite3.c</span></code> is
looked for. The SQLite code is then statically compiled into the
APSW extension and is invisible to the rest of the
process. There are no runtime library dependencies on SQLite as
a result. When you use <code class="xref std std-option docutils literal"><span class="pre">fetch</span></code> this is where it places
the downloaded amalgamation.</div></blockquote>
<p>Local build</p>
<blockquote>
<div>The header <code class="file docutils literal"><span class="pre">sqlite3/sqlite3.h</span></code> and library <code class="file docutils literal"><span class="pre">sqlite3/libsqlite3.</span><em><span class="pre">a,so,dll</span></em></code> is looked for.</div></blockquote>
<p>User directories</p>
<blockquote>
<div>If you are using Python 2.6+ or Python 3 and specified
<code class="xref std std-option docutils literal"><span class="pre">--user</span></code> then your user directory is searched first. See
<span class="target" id="index-2"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-0370"><strong>PEP 370</strong></a> for more details.</div></blockquote>
<p>System directories</p>
<blockquote>
<div>The default compiler include path (eg <code class="file docutils literal"><span class="pre">/usr/include</span></code>) and library path (eg <code class="file docutils literal"><span class="pre">/usr/lib</span></code>) are used.</div></blockquote>
</div></blockquote>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If you compiled SQLite with any OMIT flags (eg
<code class="xref py py-const docutils literal"><span class="pre">SQLITE_OMIT_LOAD_EXTENSION</span></code>) then you must include them in
the <code class="file docutils literal"><span class="pre">setup.py</span></code> command or file. For this example you could use
<code class="xref std std-option docutils literal"><span class="pre">setup.py</span> <span class="pre">build</span> <span class="pre">--omit=load_extension</span></code> to add the same flags.</p>
</div>
</div>
<div class="section" id="recommended">
<span id="recommended-build"></span><h2>Recommended<a class="headerlink" href="#recommended" title="Permalink to this headline">¶</a></h2>
<p>These instructions show how to build automatically downloading and
using the amalgamation plus other <a class="reference internal" href="extensions.html#extensions"><span class="std std-ref">Extensions</span></a>. Any existing SQLite on
your system is ignored at build time and runtime. (Note that you can
even use APSW in the same process as a different SQLite is used by
other libraries - this happens a lot on Mac.) You should follow these
instructions with your current directory being where you extracted the
APSW source to.</p>
<blockquote>
<div><p>Windows:</p>
<div class="highlight-default"><div class="highlight"><pre> <span class="c"># Leave out --compile=mingw32 flag if using Microsoft compiler</span>
<span class="o">></span> <span class="n">python</span> <span class="n">setup</span><span class="o">.</span><span class="n">py</span> <span class="n">fetch</span> <span class="o">--</span><span class="nb">all</span> <span class="n">build</span> <span class="o">--</span><span class="n">enable</span><span class="o">-</span><span class="nb">all</span><span class="o">-</span><span class="n">extensions</span> <span class="o">--</span><span class="nb">compile</span><span class="o">=</span><span class="n">mingw32</span> <span class="n">install</span> <span class="n">test</span>
</pre></div>
</div>
<p>Mac/Linux etc:</p>
<div class="highlight-default"><div class="highlight"><pre>$ python setup.py fetch --all build --enable-all-extensions install test
</pre></div>
</div>
</div></blockquote>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">There will be some warnings during the compilation step about
sqlite3.c, <a class="reference external" href="https://sqlite.org/faq.html#q17">but they are harmless</a></p>
</div>
<p>The extension just turns into a single file apsw.so (Linux/Mac) or
apsw.pyd (Windows). (More complicated name on Pythons implementing
<span class="target" id="index-3"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-3149"><strong>PEP 3149</strong></a>). You don’t need to install it and can drop it into any
directory that is more convenient for you and that your code can
reach. To just do the build and not install, leave out <em>install</em> from
the lines above. (Use <em>build_ext –inplace</em> to have the extension put
in the main directory.)</p>
<p>The test suite will be run. It will print the APSW file used, APSW and
SQLite versions and then run lots of tests all of which should pass.</p>
</div>
<div class="section" id="source-distribution-advanced">
<h2>Source distribution (advanced)<a class="headerlink" href="#source-distribution-advanced" title="Permalink to this headline">¶</a></h2>
<p>If you want to make a source distribution or a binary distribution
that creates an intermediate source distribution such as <cite>bdist_rpm</cite>
then you can have the SQLite amalgamation automatically included as
part of it. If you specify the fetch command as part of the same
command line then everything fetched is included in the source
distribution. For example this will fetch all components, include
them in the source distribution and build a rpm using those
components:</p>
<div class="highlight-default"><div class="highlight"><pre>$ python setup.py fetch --all bdist_rpm
</pre></div>
</div>
</div>
<div class="section" id="testing">
<h2>Testing<a class="headerlink" href="#testing" title="Permalink to this headline">¶</a></h2>
<p>SQLite itself is <a class="reference external" href="https://sqlite.org/testing.html">extensively tested</a>. It has considerably more code
dedicated to testing than makes up the actual database functionality.</p>
<p>APSW includes a <code class="file docutils literal"><span class="pre">tests.py</span></code> file which uses the standard Python
testing modules to verify correct operation. New code is developed
alongside the tests. Reported issues also have test cases to ensure
the issue doesn’t happen or doesn’t happen again.:</p>
<div class="highlight-default"><div class="highlight"><pre>$ python setup.py test
Python /usr/bin/python (2, 6, 6, 'final', 0)
Testing with APSW file /space/apsw/apsw.so
APSW version 3.7.4-r1
SQLite lib version 3.7.4
SQLite headers version 3007004
Using amalgamation True
............................................................................
----------------------------------------------------------------------
Ran 76 tests in 404.557s
OK
</pre></div>
</div>
<p>The tests also ensure that as much APSW code as possible is executed
including alternate paths through the code. 95.5% of the APSW code is
executed by the tests. If you checkout the APSW source then there is a
script <a class="reference external" href="https://github.com/rogerbinns/apsw/blob/master/tools/coverage.sh">tools/coverage.sh</a> that enables extra code that
deliberately induces extra conditions such as memory allocation
failures, SQLite returning undocumented error codes etc. That brings
coverage up to 99.6% of the code.</p>
<p>A memory checker <a class="reference external" href="http://valgrind.org">Valgrind</a> is used while
running the test suite. The test suite is run multiple times to make
any memory leaks or similar issues stand out. A checking version of
Python is also used. See <a class="reference external" href="https://github.com/rogerbinns/apsw/blob/master/tools/valgrind.sh">tools/valgrind.sh</a> in the source.</p>
<p>To ensure compatibility with the various Python versions, a script
downloads and compiles all supported Python versions in both 2 byte
and 4 byte Unicode character configurations against the APSW and
SQLite supported versions running the tests. See
<a class="reference external" href="https://github.com/rogerbinns/apsw/blob/master/tools/megatest.py">tools/megatest.py</a> in the source.</p>
<p>In short both SQLite and APSW have a lot of testing!</p>
</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</a><ul>
<li><a class="reference internal" href="#setup-py">setup.py</a></li>
<li><a class="reference internal" href="#additional-setup-py-flags">Additional <code class="file docutils literal"><span class="pre">setup.py</span></code> flags</a><ul>
<li><a class="reference internal" href="#fetch">fetch</a></li>
<li><a class="reference internal" href="#build-build-ext">build/build_ext</a></li>
</ul>
</li>
<li><a class="reference internal" href="#finding-sqlite-3">Finding SQLite 3</a></li>
<li><a class="reference internal" href="#recommended">Recommended</a></li>
<li><a class="reference internal" href="#source-distribution-advanced">Source distribution (advanced)</a></li>
<li><a class="reference internal" href="#testing">Testing</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="download.html"
title="previous chapter">Download</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="extensions.html"
title="next chapter">Extensions</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/build.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">
<div><input type="text" name="q" /></div>
<div><input type="submit" value="Go" /></div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</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="right" >
<a href="extensions.html" title="Extensions"
>next</a> |</li>
<li class="right" >
<a href="download.html" title="Download"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">APSW 3.16.2-r1 documentation</a> »</li>
</ul>
</div>
<div class="footer" role="contentinfo">
© <a href="copyright.html">Copyright</a> 2004-2016, Roger Binns <rogerb@rogerbinns.com>.
Last updated on Jan 14, 2017.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.4.8.
</div>
</body>
</html>
|