/usr/share/doc/python-apt-doc/html/library/apt_inst.html is in python-apt-doc 1.1.0~beta1build1.
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 547 548 549 | <!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>apt_inst - Working with local Debian packages — python-apt 1.1.0~beta1build1 documentation</title>
<link rel="stylesheet" href="../_static/alabaster.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '1.1.0~beta1build1',
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="python-apt 1.1.0~beta1build1 documentation" href="../contents.html" />
<link rel="up" title="Python APT Library" href="index.html" />
<link rel="next" title="apt.cache — The Cache class" href="apt.cache.html" />
<link rel="prev" title="apt_pkg — The low-level bindings for apt-pkg" href="apt_pkg.html" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
</head>
<body role="document">
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="module-apt_inst">
<span id="apt-inst-working-with-local-debian-packages"></span><h1><a class="reference internal" href="#module-apt_inst" title="apt_inst"><code class="xref py py-mod docutils literal"><span class="pre">apt_inst</span></code></a> - Working with local Debian packages<a class="headerlink" href="#module-apt_inst" title="Permalink to this headline">¶</a></h1>
<p>This module provides useful classes and functions to work with archives,
modelled after the <code class="xref py py-class docutils literal"><span class="pre">tarfile.TarFile</span></code> class. For working with Debian
packages, the <a class="reference internal" href="#apt_inst.DebFile" title="apt_inst.DebFile"><code class="xref py py-class docutils literal"><span class="pre">DebFile</span></code></a> class should be used as it provides easy access
to the control.tar.* and data.tar.* members.</p>
<p>The classes are mostly modeled after the <code class="xref py py-class docutils literal"><span class="pre">tarfile.TarFile</span></code> class and
enhanced with APT-specific methods. Because APT only provides a stream based
view on a tar archive, this module’s <a class="reference internal" href="#apt_inst.TarFile" title="apt_inst.TarFile"><code class="xref py py-class docutils literal"><span class="pre">TarFile</span></code></a> class only provides a
very small subset of those functions.</p>
<div class="section" id="ar-archives">
<h2>AR Archives<a class="headerlink" href="#ar-archives" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="apt_inst.ArArchive">
<em class="property">class </em><code class="descclassname">apt_inst.</code><code class="descname">ArArchive</code><span class="sig-paren">(</span><em>file</em><span class="sig-paren">)</span><a class="headerlink" href="#apt_inst.ArArchive" title="Permalink to this definition">¶</a></dt>
<dd><p>An ArArchive object represents an archive in the 4.4 BSD AR format,
which is used for e.g. deb packages.</p>
<p>The parameter <em>file</em> may be a string specifying the path of a file, or
a <code class="xref py py-class docutils literal"><span class="pre">file</span></code>-like object providing the <code class="xref py py-meth docutils literal"><span class="pre">fileno()</span></code> method. It may
also be an int specifying a file descriptor (returned by e.g.
<code class="xref py py-func docutils literal"><span class="pre">os.open()</span></code>). The recommended way is to pass in the path to the file.</p>
<p>ArArchive (and its subclasses) support the iterator protocol, meaning that
an <a class="reference internal" href="#apt_inst.ArArchive" title="apt_inst.ArArchive"><code class="xref py py-class docutils literal"><span class="pre">ArArchive</span></code></a> object can be iterated over yielding the members in
the archive (same as <a class="reference internal" href="#apt_inst.ArArchive.getmembers" title="apt_inst.ArArchive.getmembers"><code class="xref py py-meth docutils literal"><span class="pre">getmembers()</span></code></a>).</p>
<dl class="describe">
<dt>
<code class="descname">archive[key]</code></dt>
<dd><p>Return a ArMember object for the member given by <em>key</em>. Raise
LookupError if there is no ArMember with the given name.</p>
</dd></dl>
<dl class="describe">
<dt>
<code class="descname">key in archive</code></dt>
<dd><p>Return True if a member with the name <em>key</em> is found in the archive, it
is the same function as <a class="reference internal" href="#apt_inst.ArArchive.getmember" title="apt_inst.ArArchive.getmember"><code class="xref py py-meth docutils literal"><span class="pre">getmember()</span></code></a>.</p>
</dd></dl>
<dl class="method">
<dt id="apt_inst.ArArchive.extract">
<code class="descname">extract</code><span class="sig-paren">(</span><em>name</em><span class="optional">[</span>, <em>target: str</em><span class="optional">]</span><span class="sig-paren">)</span> → bool<a class="headerlink" href="#apt_inst.ArArchive.extract" title="Permalink to this definition">¶</a></dt>
<dd><p>Extract the member given by <em>name</em> into the directory given by
<em>target</em>. If the extraction failed, an error is raised. Otherwise,
the method returns True if the owner could be set or False if the
owner could not be changed. It may also raise LookupError if there
is no member with the given name.</p>
<p>The parameter <em>target</em> is completely optional. If it is not given, the
function extracts into the current directory.</p>
</dd></dl>
<dl class="method">
<dt id="apt_inst.ArArchive.extractall">
<code class="descname">extractall</code><span class="sig-paren">(</span><span class="optional">[</span><em>target: str</em><span class="optional">]</span><span class="sig-paren">)</span> → bool<a class="headerlink" href="#apt_inst.ArArchive.extractall" title="Permalink to this definition">¶</a></dt>
<dd><p>Extract all into the directory given by target or the current
directory if target is not given. If the extraction failed, an error
is raised. Otherwise, the method returns True if the owner could be
set or False if the owner could not be changed.</p>
</dd></dl>
<dl class="method">
<dt id="apt_inst.ArArchive.extractdata">
<code class="descname">extractdata</code><span class="sig-paren">(</span><em>name: str</em><span class="sig-paren">)</span> → bytes<a class="headerlink" href="#apt_inst.ArArchive.extractdata" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the contents of the member given by <em>name</em>, as a bytes object.
Raise LookupError if there is no ArMember with the given name.</p>
</dd></dl>
<dl class="method">
<dt id="apt_inst.ArArchive.getmember">
<code class="descname">getmember</code><span class="sig-paren">(</span><em>name: str</em><span class="sig-paren">)</span> → ArMember<a class="headerlink" href="#apt_inst.ArArchive.getmember" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a ArMember object for the member given by <em>name</em>. Raise
LookupError if there is no ArMember with the given name.</p>
</dd></dl>
<dl class="method">
<dt id="apt_inst.ArArchive.getmembers">
<code class="descname">getmembers</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → list<a class="headerlink" href="#apt_inst.ArArchive.getmembers" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a list of all members in the AR archive.</p>
</dd></dl>
<dl class="method">
<dt id="apt_inst.ArArchive.getnames">
<code class="descname">getnames</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → list<a class="headerlink" href="#apt_inst.ArArchive.getnames" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a list of the names of all members in the AR archive.</p>
</dd></dl>
<dl class="method">
<dt id="apt_inst.ArArchive.gettar">
<code class="descname">gettar</code><span class="sig-paren">(</span><em>name: str</em>, <em>comp: str</em><span class="sig-paren">)</span> → TarFile<a class="headerlink" href="#apt_inst.ArArchive.gettar" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a TarFile object for the member given by <em>name</em> which will be
decompressed using the compression algorithm given by <em>comp</em>.
This is almost equal to:</p>
<div class="highlight-python"><div class="highlight"><pre>member = arfile.getmember(name)
tarfile = TarFile(file, member.start, member.size, 'gzip')'
</pre></div>
</div>
<p>It just opens a new TarFile on the given position in the stream.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="apt_inst.ArMember">
<em class="property">class </em><code class="descclassname">apt_inst.</code><code class="descname">ArMember</code><a class="headerlink" href="#apt_inst.ArMember" title="Permalink to this definition">¶</a></dt>
<dd><p>An ArMember object represents a single file within an AR archive. For
Debian packages this can be e.g. control.tar.gz. This class provides
information about this file, such as the mode and size. It has no
constructor.</p>
<dl class="attribute">
<dt id="apt_inst.ArMember.gid">
<code class="descname">gid</code><a class="headerlink" href="#apt_inst.ArMember.gid" title="Permalink to this definition">¶</a></dt>
<dd><p>The group id of the owner.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt_inst.ArMember.mode">
<code class="descname">mode</code><a class="headerlink" href="#apt_inst.ArMember.mode" title="Permalink to this definition">¶</a></dt>
<dd><p>The mode of the file.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt_inst.ArMember.mtime">
<code class="descname">mtime</code><a class="headerlink" href="#apt_inst.ArMember.mtime" title="Permalink to this definition">¶</a></dt>
<dd><p>Last time of modification.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt_inst.ArMember.name">
<code class="descname">name</code><a class="headerlink" href="#apt_inst.ArMember.name" title="Permalink to this definition">¶</a></dt>
<dd><p>The name of the file.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt_inst.ArMember.size">
<code class="descname">size</code><a class="headerlink" href="#apt_inst.ArMember.size" title="Permalink to this definition">¶</a></dt>
<dd><p>The size of the files.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt_inst.ArMember.start">
<code class="descname">start</code><a class="headerlink" href="#apt_inst.ArMember.start" title="Permalink to this definition">¶</a></dt>
<dd><p>The offset in the archive where the file starts.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt_inst.ArMember.uid">
<code class="descname">uid</code><a class="headerlink" href="#apt_inst.ArMember.uid" title="Permalink to this definition">¶</a></dt>
<dd><p>The user id of the owner.</p>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="debian-packages">
<h2>Debian Packages<a class="headerlink" href="#debian-packages" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="apt_inst.DebFile">
<em class="property">class </em><code class="descclassname">apt_inst.</code><code class="descname">DebFile</code><span class="sig-paren">(</span><em>file</em><span class="sig-paren">)</span><a class="headerlink" href="#apt_inst.DebFile" title="Permalink to this definition">¶</a></dt>
<dd><p>A DebFile object represents a file in the .deb package format. It inherits
<a class="reference internal" href="#apt_inst.ArArchive" title="apt_inst.ArArchive"><code class="xref py py-class docutils literal"><span class="pre">ArArchive</span></code></a>. In addition to the attributes and methods from
<a class="reference internal" href="#apt_inst.ArArchive" title="apt_inst.ArArchive"><code class="xref py py-class docutils literal"><span class="pre">ArArchive</span></code></a>, DebFile provides the following methods:</p>
<dl class="attribute">
<dt id="apt_inst.DebFile.control">
<code class="descname">control</code><a class="headerlink" href="#apt_inst.DebFile.control" title="Permalink to this definition">¶</a></dt>
<dd><p>The <a class="reference internal" href="#apt_inst.TarFile" title="apt_inst.TarFile"><code class="xref py py-class docutils literal"><span class="pre">TarFile</span></code></a> object associated with the control.tar.gz member.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt_inst.DebFile.data">
<code class="descname">data</code><a class="headerlink" href="#apt_inst.DebFile.data" title="Permalink to this definition">¶</a></dt>
<dd><p>The <a class="reference internal" href="#apt_inst.TarFile" title="apt_inst.TarFile"><code class="xref py py-class docutils literal"><span class="pre">TarFile</span></code></a> object associated with the
data.tar.{gz,bz2,lzma,xz} member.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt_inst.DebFile.debian_binary">
<code class="descname">debian_binary</code><a class="headerlink" href="#apt_inst.DebFile.debian_binary" title="Permalink to this definition">¶</a></dt>
<dd><p>The package version, as contained in debian-binary.</p>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="tar-archives">
<h2>Tar Archives<a class="headerlink" href="#tar-archives" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="apt_inst.TarFile">
<em class="property">class </em><code class="descclassname">apt_inst.</code><code class="descname">TarFile</code><span class="sig-paren">(</span><em>file</em><span class="optional">[</span>, <em>min: int</em>, <em>max: int</em>, <em>comp: str</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#apt_inst.TarFile" title="Permalink to this definition">¶</a></dt>
<dd><p>A TarFile object represents a single .tar file stream.</p>
<p>The parameter <em>file</em> may be a string specifying the path of a file, or
a <code class="xref py py-class docutils literal"><span class="pre">file</span></code>-like object providing the <code class="xref py py-meth docutils literal"><span class="pre">fileno()</span></code> method. It may
also be an int specifying a file descriptor (returned by e.g.
<code class="xref py py-func docutils literal"><span class="pre">os.open()</span></code>).</p>
<p>The parameter <em>min</em> describes the offset in the file where the archive
begins and the parameter <em>max</em> is the size of the archive.</p>
<p>The compression of the archive is set by the parameter <em>comp</em>. It can
be set to any program supporting the -d switch, the default being gzip.</p>
<dl class="method">
<dt id="apt_inst.TarFile.extractall">
<code class="descname">extractall</code><span class="sig-paren">(</span><span class="optional">[</span><em>rootdir: str</em><span class="optional">]</span><span class="sig-paren">)</span> → True<a class="headerlink" href="#apt_inst.TarFile.extractall" title="Permalink to this definition">¶</a></dt>
<dd><p>Extract the archive in the current directory. The argument <em>rootdir</em>
can be used to change the target directory.</p>
</dd></dl>
<dl class="method">
<dt id="apt_inst.TarFile.extractdata">
<code class="descname">extractdata</code><span class="sig-paren">(</span><em>member: str</em><span class="sig-paren">)</span> → bytes<a class="headerlink" href="#apt_inst.TarFile.extractdata" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the contents of the member, as a bytes object. Raise
LookupError if there is no member with the given name.</p>
</dd></dl>
<dl class="method">
<dt id="apt_inst.TarFile.go">
<code class="descname">go</code><span class="sig-paren">(</span><em>callback: callable</em><span class="optional">[</span>, <em>member: str</em><span class="optional">]</span><span class="sig-paren">)</span> → True<a class="headerlink" href="#apt_inst.TarFile.go" title="Permalink to this definition">¶</a></dt>
<dd><p>Go through the archive and call the callable <em>callback</em> for each
member with 2 arguments. The first argument is the <a class="reference internal" href="#apt_inst.TarMember" title="apt_inst.TarMember"><code class="xref py py-class docutils literal"><span class="pre">TarMember</span></code></a>
and the second one is the data, as bytes.</p>
<p>The optional parameter <em>member</em> can be used to specify the member for
which call the callback. If not specified, it will be called for all
members. If specified and not found, LookupError will be raised.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="apt_inst.TarMember">
<em class="property">class </em><code class="descclassname">apt_inst.</code><code class="descname">TarMember</code><a class="headerlink" href="#apt_inst.TarMember" title="Permalink to this definition">¶</a></dt>
<dd><p>Represent a single member of a ‘tar’ archive.</p>
<p>This class which has been modelled after <code class="xref py py-class docutils literal"><span class="pre">tarfile.TarInfo</span></code>
represents information about a given member in an archive.</p>
<dl class="method">
<dt id="apt_inst.TarMember.isblk">
<code class="descname">isblk</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#apt_inst.TarMember.isblk" title="Permalink to this definition">¶</a></dt>
<dd><p>Determine whether the member is a block device.</p>
</dd></dl>
<dl class="method">
<dt id="apt_inst.TarMember.ischr">
<code class="descname">ischr</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#apt_inst.TarMember.ischr" title="Permalink to this definition">¶</a></dt>
<dd><p>Determine whether the member is a character device.</p>
</dd></dl>
<dl class="method">
<dt id="apt_inst.TarMember.isdev">
<code class="descname">isdev</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#apt_inst.TarMember.isdev" title="Permalink to this definition">¶</a></dt>
<dd><p>Determine whether the member is a device (block,character or FIFO).</p>
</dd></dl>
<dl class="method">
<dt id="apt_inst.TarMember.isdir">
<code class="descname">isdir</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#apt_inst.TarMember.isdir" title="Permalink to this definition">¶</a></dt>
<dd><p>Determine whether the member is a directory.</p>
</dd></dl>
<dl class="method">
<dt id="apt_inst.TarMember.isfifo">
<code class="descname">isfifo</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#apt_inst.TarMember.isfifo" title="Permalink to this definition">¶</a></dt>
<dd><p>Determine whether the member is a FIFO.</p>
</dd></dl>
<dl class="method">
<dt id="apt_inst.TarMember.isfile">
<code class="descname">isfile</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#apt_inst.TarMember.isfile" title="Permalink to this definition">¶</a></dt>
<dd><p>Determine whether the member is a regular file.</p>
</dd></dl>
<dl class="method">
<dt id="apt_inst.TarMember.islnk">
<code class="descname">islnk</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#apt_inst.TarMember.islnk" title="Permalink to this definition">¶</a></dt>
<dd><p>Determine whether the member is a hardlink.</p>
</dd></dl>
<dl class="method">
<dt id="apt_inst.TarMember.isreg">
<code class="descname">isreg</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#apt_inst.TarMember.isreg" title="Permalink to this definition">¶</a></dt>
<dd><p>Determine whether the member is a regular file, same as isfile().</p>
</dd></dl>
<dl class="method">
<dt id="apt_inst.TarMember.issym">
<code class="descname">issym</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#apt_inst.TarMember.issym" title="Permalink to this definition">¶</a></dt>
<dd><p>Determine whether the member is a symbolic link.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt_inst.TarMember.gid">
<code class="descname">gid</code><a class="headerlink" href="#apt_inst.TarMember.gid" title="Permalink to this definition">¶</a></dt>
<dd><p>The owner’s group id</p>
</dd></dl>
<dl class="attribute">
<dt id="apt_inst.TarMember.linkname">
<code class="descname">linkname</code><a class="headerlink" href="#apt_inst.TarMember.linkname" title="Permalink to this definition">¶</a></dt>
<dd><p>The target of the link.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt_inst.TarMember.major">
<code class="descname">major</code><a class="headerlink" href="#apt_inst.TarMember.major" title="Permalink to this definition">¶</a></dt>
<dd><p>The major ID of the device.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt_inst.TarMember.minor">
<code class="descname">minor</code><a class="headerlink" href="#apt_inst.TarMember.minor" title="Permalink to this definition">¶</a></dt>
<dd><p>The minor ID of the device.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt_inst.TarMember.mode">
<code class="descname">mode</code><a class="headerlink" href="#apt_inst.TarMember.mode" title="Permalink to this definition">¶</a></dt>
<dd><p>The mode (permissions).</p>
</dd></dl>
<dl class="attribute">
<dt id="apt_inst.TarMember.mtime">
<code class="descname">mtime</code><a class="headerlink" href="#apt_inst.TarMember.mtime" title="Permalink to this definition">¶</a></dt>
<dd><p>Last time of modification.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt_inst.TarMember.name">
<code class="descname">name</code><a class="headerlink" href="#apt_inst.TarMember.name" title="Permalink to this definition">¶</a></dt>
<dd><p>The name of the file.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt_inst.TarMember.size">
<code class="descname">size</code><a class="headerlink" href="#apt_inst.TarMember.size" title="Permalink to this definition">¶</a></dt>
<dd><p>The size of the file.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt_inst.TarMember.uid">
<code class="descname">uid</code><a class="headerlink" href="#apt_inst.TarMember.uid" title="Permalink to this definition">¶</a></dt>
<dd><p>The owner’s user id.</p>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="deprecated-functions">
<h2>Deprecated functions<a class="headerlink" href="#deprecated-functions" title="Permalink to this headline">¶</a></h2>
<p>The following functions have been shipped in python-apt for a longer time and
are deprecated as of release 0.7.92. They are listed here to help developers
to port their applications to the new API which is completely different. For
this purpose each function documentation includes an example showing how the
function can be replaced.</p>
<dl class="function">
<dt id="apt_inst.arCheckMember">
<code class="descclassname">apt_inst.</code><code class="descname">arCheckMember</code><span class="sig-paren">(</span><em>file</em>, <em>membername</em><span class="sig-paren">)</span><a class="headerlink" href="#apt_inst.arCheckMember" title="Permalink to this definition">¶</a></dt>
<dd><p>Check if the member specified by the parameter <em>membername</em> exists in
the AR file referenced by the parameter <em>file</em>, which may be a
<code class="xref py py-class docutils literal"><span class="pre">file()</span></code> object, a file descriptor, or anything implementing a
<code class="xref py py-meth docutils literal"><span class="pre">fileno()</span></code> method.</p>
<p>This function has been replaced by using the <code class="xref std std-keyword docutils literal"><span class="pre">in</span></code> check on an
<a class="reference internal" href="#apt_inst.ArArchive" title="apt_inst.ArArchive"><code class="xref py py-class docutils literal"><span class="pre">ArArchive</span></code></a> object:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">member</span> <span class="ow">in</span> <span class="n">ArArchive</span><span class="p">(</span><span class="nb">file</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="apt_inst.debExtract">
<code class="descclassname">apt_inst.</code><code class="descname">debExtract</code><span class="sig-paren">(</span><em>file</em>, <em>func</em>, <em>chunk</em><span class="sig-paren">)</span><a class="headerlink" href="#apt_inst.debExtract" title="Permalink to this definition">¶</a></dt>
<dd><p>Call the function referenced by <em>func</em> for each member of the tar file
<em>chunk</em> which is contained in the AR file referenced by the parameter
<em>file</em>, which may be a <code class="xref py py-class docutils literal"><span class="pre">file()</span></code> object, a file descriptor, or
anything implementing a <code class="xref py py-meth docutils literal"><span class="pre">fileno()</span></code> method.</p>
<p>The function <em>func</em> is a callback with the signature
<code class="docutils literal"><span class="pre">(what,</span> <span class="pre">name,</span> <span class="pre">link,</span> <span class="pre">mode,</span> <span class="pre">uid,</span> <span class="pre">gid,</span> <span class="pre">size,</span> <span class="pre">mtime,</span> <span class="pre">major,</span> <span class="pre">minor)</span></code>. The
parameter <em>what</em> describes the type of the member. It can be ‘FILE’,
‘DIR’, or ‘HARDLINK’. The parameter <em>name</em> refers to the name of the
member. In case of links, <em>link</em> refers to the target of the link.</p>
<p>This function is deprecated and has been replaced by the <a class="reference internal" href="#apt_inst.TarFile.go" title="apt_inst.TarFile.go"><code class="xref py py-meth docutils literal"><span class="pre">TarFile.go()</span></code></a>
method. The following example shows the old code and the new code:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">debExtract</span><span class="p">(</span><span class="nb">open</span><span class="p">(</span><span class="s">"package.deb"</span><span class="p">),</span> <span class="n">my_callback</span><span class="p">,</span> <span class="s">"data.tar.gz"</span><span class="p">)</span> <span class="c">#old</span>
<span class="n">DebFile</span><span class="p">(</span><span class="s">"package.deb"</span><span class="p">)</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">go</span><span class="p">(</span><span class="n">my_callback</span><span class="p">)</span>
</pre></div>
</div>
<p>Please note that the signature of the callback is different in
<a class="reference internal" href="#apt_inst.TarFile.go" title="apt_inst.TarFile.go"><code class="xref py py-meth docutils literal"><span class="pre">TarFile.go()</span></code></a>.</p>
</dd></dl>
<dl class="function">
<dt id="apt_inst.tarExtract">
<code class="descclassname">apt_inst.</code><code class="descname">tarExtract</code><span class="sig-paren">(</span><em>file</em>, <em>func</em>, <em>comp</em><span class="sig-paren">)</span><a class="headerlink" href="#apt_inst.tarExtract" title="Permalink to this definition">¶</a></dt>
<dd><p>Call the function <em>func</em> for each member of the tar file <em>file</em>.</p>
<p>The parameter <em>comp</em> is a string determining the compressor used. Possible
options are “xz”, “lzma”, “bzip2” and “gzip”. The parameter <em>file</em> may be
a <code class="xref py py-class docutils literal"><span class="pre">file()</span></code> object, a file descriptor, or anything implementing
a <code class="xref py py-meth docutils literal"><span class="pre">fileno()</span></code> method.</p>
<p>The function <em>func</em> is a callback with the signature
<code class="docutils literal"><span class="pre">(what,</span> <span class="pre">name,</span> <span class="pre">link,</span> <span class="pre">mode,</span> <span class="pre">uid,</span> <span class="pre">gid,</span> <span class="pre">size,</span> <span class="pre">mtime,</span> <span class="pre">major,</span> <span class="pre">minor)</span></code>. The
parameter <em>what</em> describes the type of the member. It can be ‘FILE’,
‘DIR’, or ‘HARDLINK’. The parameter <em>name</em> refers to the name of the
member. In case of links, <em>link</em> refers to the target of the link.</p>
<p>This function is deprecated and has been replaced by the <a class="reference internal" href="#apt_inst.TarFile.go" title="apt_inst.TarFile.go"><code class="xref py py-meth docutils literal"><span class="pre">TarFile.go()</span></code></a>
method. The following example shows the old code and the new code:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">tarExtract</span><span class="p">(</span><span class="nb">open</span><span class="p">(</span><span class="s">"archive.tar.gz"</span><span class="p">),</span> <span class="n">my_callback</span><span class="p">,</span> <span class="s">"gzip"</span><span class="p">)</span> <span class="c">#old</span>
<span class="n">TarFile</span><span class="p">(</span><span class="s">"archive.tar.gz"</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="s">"gzip"</span><span class="p">)</span><span class="o">.</span><span class="n">go</span><span class="p">(</span><span class="n">my_callback</span><span class="p">)</span>
</pre></div>
</div>
<p>Please note that the signature of the callback is different in
<a class="reference internal" href="#apt_inst.TarFile.go" title="apt_inst.TarFile.go"><code class="xref py py-meth docutils literal"><span class="pre">TarFile.go()</span></code></a>.</p>
</dd></dl>
<dl class="function">
<dt id="apt_inst.debExtractArchive">
<code class="descclassname">apt_inst.</code><code class="descname">debExtractArchive</code><span class="sig-paren">(</span><em>file</em>, <em>rootdir</em><span class="sig-paren">)</span><a class="headerlink" href="#apt_inst.debExtractArchive" title="Permalink to this definition">¶</a></dt>
<dd><p>Extract the archive referenced by the <code class="xref py py-class docutils literal"><span class="pre">file</span></code> object <em>file</em>
into the directory specified by <em>rootdir</em>.</p>
<p>The parameter <em>file</em> may be a <code class="xref py py-class docutils literal"><span class="pre">file()</span></code> object, a file descriptor, or
anything implementing a <code class="xref py py-meth docutils literal"><span class="pre">fileno()</span></code> method.</p>
<p>This function has been replaced by <a class="reference internal" href="#apt_inst.TarFile.extractall" title="apt_inst.TarFile.extractall"><code class="xref py py-meth docutils literal"><span class="pre">TarFile.extractall()</span></code></a> and
<a class="reference internal" href="#apt_inst.DebFile.data" title="apt_inst.DebFile.data"><code class="xref py py-attr docutils literal"><span class="pre">DebFile.data</span></code></a>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">debExtractArchive</span><span class="p">(</span><span class="nb">open</span><span class="p">(</span><span class="s">"package.deb"</span><span class="p">),</span> <span class="n">rootdir</span><span class="p">)</span> <span class="c"># old</span>
<span class="n">DebFile</span><span class="p">(</span><span class="s">"package.deb"</span><span class="p">)</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">extractall</span><span class="p">(</span><span class="n">rootdir</span><span class="p">)</span> <span class="c"># new</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="apt_inst.debExtractControl">
<code class="descclassname">apt_inst.</code><code class="descname">debExtractControl</code><span class="sig-paren">(</span><em>file</em><span class="optional">[</span>, <em>member='control'</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#apt_inst.debExtractControl" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the indicated file as a string from the control tar. The default
is ‘control’. The parameter <em>file</em> may be a <code class="xref py py-class docutils literal"><span class="pre">file()</span></code> object, a
file descriptor, or anything implementing a <code class="xref py py-meth docutils literal"><span class="pre">fileno()</span></code> method.</p>
<p>This function has been replaced by <a class="reference internal" href="#apt_inst.DebFile.control" title="apt_inst.DebFile.control"><code class="xref py py-attr docutils literal"><span class="pre">DebFile.control</span></code></a> and
<a class="reference internal" href="#apt_inst.TarFile.extractdata" title="apt_inst.TarFile.extractdata"><code class="xref py py-meth docutils literal"><span class="pre">TarFile.extractdata()</span></code></a>. In the following example, both commands
return the contents of the control file:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">debExtractControl</span><span class="p">(</span><span class="nb">open</span><span class="p">(</span><span class="s">"package.deb"</span><span class="p">))</span>
<span class="n">DebFile</span><span class="p">(</span><span class="s">"package.deb"</span><span class="p">)</span><span class="o">.</span><span class="n">control</span><span class="o">.</span><span class="n">extractdata</span><span class="p">(</span><span class="s">"control"</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="../contents.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#"><code class="docutils literal"><span class="pre">apt_inst</span></code> - Working with local Debian packages</a><ul>
<li><a class="reference internal" href="#ar-archives">AR Archives</a></li>
<li><a class="reference internal" href="#debian-packages">Debian Packages</a></li>
<li><a class="reference internal" href="#tar-archives">Tar Archives</a></li>
<li><a class="reference internal" href="#deprecated-functions">Deprecated functions</a></li>
</ul>
</li>
</ul>
<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="../contents.html">Documentation overview</a><ul>
<li><a href="index.html">Python APT Library</a><ul>
<li>Previous: <a href="apt_pkg.html" title="previous chapter"><code class="docutils literal"><span class="pre">apt_pkg</span></code> — The low-level bindings for apt-pkg</a></li>
<li>Next: <a href="apt.cache.html" title="next chapter"><code class="docutils literal"><span class="pre">apt.cache</span></code> — The Cache class</a></li>
</ul></li>
</ul></li>
</ul>
</div>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/library/apt_inst.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="footer">
©2009-2010, Julian Andres Klode <jak@debian.org>.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.4</a>
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.6</a>
|
<a href="../_sources/library/apt_inst.txt"
rel="nofollow">Page source</a>
</div>
</body>
</html>
|