/usr/share/doc/python-apt/html/library/apt.package.html is in python-apt-doc 0.9.3.12.
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 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 | <!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.package — Classes for package handling — python-apt 0.9.3.12 documentation</title>
<link rel="stylesheet" href="../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '0.9.3.12',
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 0.9.3.12 documentation" href="../index.html" />
<link rel="up" title="Python APT Library" href="index.html" />
<link rel="next" title="apt.progress.base — Abstract classes for progress reporting" href="apt.progress.base.html" />
<link rel="prev" title="apt.debfile — Classes related to debian package files" href="apt.debfile.html" />
<link rel="shortcut icon" type="image/png" href="../_static/py.png" />
</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="apt.progress.base.html" title="apt.progress.base — Abstract classes for progress reporting"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="apt.debfile.html" title="apt.debfile — Classes related to debian package files"
accesskey="P">previous</a> |</li>
<li><img src="../_static/py.png" alt=""
style="vertical-align: middle; margin-top: -1px"/></li>
<li><a href="../index.html">python-apt 0.9.3.12 documentation</a> »</li>
<li><a href="index.html" accesskey="U">Python APT Library</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="module-apt.package">
<span id="apt-package-classes-for-package-handling"></span><h1><a class="reference internal" href="#module-apt.package" title="apt.package"><tt class="xref py py-mod docutils literal"><span class="pre">apt.package</span></tt></a> — Classes for package handling<a class="headerlink" href="#module-apt.package" title="Permalink to this headline">¶</a></h1>
<p>Functionality related to packages.</p>
<div class="section" id="the-package-class">
<h2>The Package class<a class="headerlink" href="#the-package-class" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="apt.package.Package">
<em class="property">class </em><tt class="descclassname">apt.package.</tt><tt class="descname">Package</tt><big>(</big><em>pcache</em>, <em>pkgiter</em><big>)</big><a class="headerlink" href="#apt.package.Package" title="Permalink to this definition">¶</a></dt>
<dd><p>Representation of a package in a cache.</p>
<p>This class provides methods and properties for working with a package. It
lets you mark the package for installation, check if it is installed, and
much more.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Several methods have been deprecated in version 0.7.9 of python-apt,
please see the <a class="reference internal" href="#apt.package.Version" title="apt.package.Version"><tt class="xref py py-class docutils literal"><span class="pre">Version</span></tt></a> class for the new alternatives.</p>
</div>
<dl class="method">
<dt id="apt.package.Package.architecture">
<tt class="descname">architecture</tt><big>(</big><big>)</big><a class="headerlink" href="#apt.package.Package.architecture" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the Architecture of the package.</p>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 0.7.100.3: </span>This is now the package’s architecture in the multi-arch sense,
previously it was the architecture of the candidate version
and deprecated.</p>
</div>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Package.candidate">
<tt class="descname">candidate</tt><a class="headerlink" href="#apt.package.Package.candidate" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the candidate version of the package.</p>
<p>This property is writeable to allow you to set the candidate version
of the package. Just assign a Version() object, and it will be set as
the candidate version.</p>
</dd></dl>
<dl class="method">
<dt id="apt.package.Package.commit">
<tt class="descname">commit</tt><big>(</big><em>fprogress</em>, <em>iprogress</em><big>)</big><a class="headerlink" href="#apt.package.Package.commit" title="Permalink to this definition">¶</a></dt>
<dd><p>Commit the changes.</p>
<p>The parameter <em>fprogress</em> refers to a apt_pkg.AcquireProgress() object,
like apt.progress.text.AcquireProgress().</p>
<p>The parameter <em>iprogress</em> refers to an InstallProgress() object, as
found in apt.progress.base.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Package.essential">
<tt class="descname">essential</tt><a class="headerlink" href="#apt.package.Package.essential" title="Permalink to this definition">¶</a></dt>
<dd><p>Return True if the package is an essential part of the system.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Package.fullname">
<tt class="descname">fullname</tt><a class="headerlink" href="#apt.package.Package.fullname" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the name of the package, including architecture.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.7.100.3.</span></p>
</div>
</dd></dl>
<dl class="method">
<dt id="apt.package.Package.get_changelog">
<tt class="descname">get_changelog</tt><big>(</big><em>uri=None</em>, <em>cancel_lock=None</em><big>)</big><a class="headerlink" href="#apt.package.Package.get_changelog" title="Permalink to this definition">¶</a></dt>
<dd><p>Download the changelog of the package and return it as unicode
string.</p>
<p>The parameter <em>uri</em> refers to the uri of the changelog file. It may
contain multiple named variables which will be substitued. These
variables are (src_section, prefix, src_pkg, src_ver). An example is
the Ubuntu changelog:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="s">"http://changelogs.ubuntu.com/changelogs/pool"</span> \
<span class="s">"/</span><span class="si">%(src_section)s</span><span class="s">/</span><span class="si">%(prefix)s</span><span class="s">/</span><span class="si">%(src_pkg)s</span><span class="s">"</span> \
<span class="s">"/</span><span class="si">%(src_pkg)s</span><span class="s">_</span><span class="si">%(src_ver)s</span><span class="s">/changelog"</span>
</pre></div>
</div>
<p>The parameter <em>cancel_lock</em> refers to an instance of threading.Lock,
which if set, prevents the download.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Package.has_config_files">
<tt class="descname">has_config_files</tt><a class="headerlink" href="#apt.package.Package.has_config_files" title="Permalink to this definition">¶</a></dt>
<dd><p>Checks whether the package is is the config-files state.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Package.id">
<tt class="descname">id</tt><a class="headerlink" href="#apt.package.Package.id" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a uniq ID for the package.</p>
<p>This can be used eg. to store additional information about the pkg.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Package.installed">
<tt class="descname">installed</tt><a class="headerlink" href="#apt.package.Package.installed" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the currently installed version of the package.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.7.9.</span></p>
</div>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Package.installed_files">
<tt class="descname">installed_files</tt><a class="headerlink" href="#apt.package.Package.installed_files" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a list of files installed by the package.</p>
<p>Return a list of unicode names of the files which have
been installed by this package</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Package.is_auto_installed">
<tt class="descname">is_auto_installed</tt><a class="headerlink" href="#apt.package.Package.is_auto_installed" title="Permalink to this definition">¶</a></dt>
<dd><p>Return whether the package is marked as automatically installed.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Package.is_auto_removable">
<tt class="descname">is_auto_removable</tt><a class="headerlink" href="#apt.package.Package.is_auto_removable" title="Permalink to this definition">¶</a></dt>
<dd><p>Return <tt class="docutils literal"><span class="pre">True</span></tt> if the package is no longer required.</p>
<p>If the package has been installed automatically as a dependency of
another package, and if no packages depend on it anymore, the package
is no longer required.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Package.is_inst_broken">
<tt class="descname">is_inst_broken</tt><a class="headerlink" href="#apt.package.Package.is_inst_broken" title="Permalink to this definition">¶</a></dt>
<dd><p>Return True if the to-be-installed package is broken.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Package.is_installed">
<tt class="descname">is_installed</tt><a class="headerlink" href="#apt.package.Package.is_installed" title="Permalink to this definition">¶</a></dt>
<dd><p>Return <tt class="docutils literal"><span class="pre">True</span></tt> if the package is installed.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Package.is_now_broken">
<tt class="descname">is_now_broken</tt><a class="headerlink" href="#apt.package.Package.is_now_broken" title="Permalink to this definition">¶</a></dt>
<dd><p>Return True if the installed package is broken.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Package.is_upgradable">
<tt class="descname">is_upgradable</tt><a class="headerlink" href="#apt.package.Package.is_upgradable" title="Permalink to this definition">¶</a></dt>
<dd><p>Return <tt class="docutils literal"><span class="pre">True</span></tt> if the package is upgradable.</p>
</dd></dl>
<dl class="method">
<dt id="apt.package.Package.mark_auto">
<tt class="descname">mark_auto</tt><big>(</big><em>auto=True</em><big>)</big><a class="headerlink" href="#apt.package.Package.mark_auto" title="Permalink to this definition">¶</a></dt>
<dd><p>Mark a package as automatically installed.</p>
<p>Call this function to mark a package as automatically installed. If the
optional parameter <em>auto</em> is set to <tt class="docutils literal"><span class="pre">False</span></tt>, the package will not be
marked as automatically installed anymore. The default is <tt class="docutils literal"><span class="pre">True</span></tt>.</p>
</dd></dl>
<dl class="method">
<dt id="apt.package.Package.mark_delete">
<tt class="descname">mark_delete</tt><big>(</big><em>auto_fix=True</em>, <em>purge=False</em><big>)</big><a class="headerlink" href="#apt.package.Package.mark_delete" title="Permalink to this definition">¶</a></dt>
<dd><p>Mark a package for deletion.</p>
<p>If <em>auto_fix</em> is <tt class="docutils literal"><span class="pre">True</span></tt>, the resolver will be run, trying to fix
broken packages. This is the default.</p>
<p>If <em>purge</em> is <tt class="docutils literal"><span class="pre">True</span></tt>, remove the configuration files of the package
as well. The default is to keep the configuration.</p>
</dd></dl>
<dl class="method">
<dt id="apt.package.Package.mark_install">
<tt class="descname">mark_install</tt><big>(</big><em>auto_fix=True</em>, <em>auto_inst=True</em>, <em>from_user=True</em><big>)</big><a class="headerlink" href="#apt.package.Package.mark_install" title="Permalink to this definition">¶</a></dt>
<dd><p>Mark a package for install.</p>
<p>If <em>autoFix</em> is <tt class="docutils literal"><span class="pre">True</span></tt>, the resolver will be run, trying to fix
broken packages. This is the default.</p>
<p>If <em>autoInst</em> is <tt class="docutils literal"><span class="pre">True</span></tt>, the dependencies of the packages will be
installed automatically. This is the default.</p>
<p>If <em>fromUser</em> is <tt class="docutils literal"><span class="pre">True</span></tt>, this package will not be marked as
automatically installed. This is the default. Set it to False if you
want to be able to automatically remove the package at a later stage
when no other package depends on it.</p>
</dd></dl>
<dl class="method">
<dt id="apt.package.Package.mark_keep">
<tt class="descname">mark_keep</tt><big>(</big><big>)</big><a class="headerlink" href="#apt.package.Package.mark_keep" title="Permalink to this definition">¶</a></dt>
<dd><p>Mark a package for keep.</p>
</dd></dl>
<dl class="method">
<dt id="apt.package.Package.mark_upgrade">
<tt class="descname">mark_upgrade</tt><big>(</big><em>from_user=True</em><big>)</big><a class="headerlink" href="#apt.package.Package.mark_upgrade" title="Permalink to this definition">¶</a></dt>
<dd><p>Mark a package for upgrade.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Package.marked_delete">
<tt class="descname">marked_delete</tt><a class="headerlink" href="#apt.package.Package.marked_delete" title="Permalink to this definition">¶</a></dt>
<dd><p>Return <tt class="docutils literal"><span class="pre">True</span></tt> if the package is marked for delete.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Package.marked_downgrade">
<tt class="descname">marked_downgrade</tt><a class="headerlink" href="#apt.package.Package.marked_downgrade" title="Permalink to this definition">¶</a></dt>
<dd><p>Package is marked for downgrade</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Package.marked_install">
<tt class="descname">marked_install</tt><a class="headerlink" href="#apt.package.Package.marked_install" title="Permalink to this definition">¶</a></dt>
<dd><p>Return <tt class="docutils literal"><span class="pre">True</span></tt> if the package is marked for install.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Package.marked_keep">
<tt class="descname">marked_keep</tt><a class="headerlink" href="#apt.package.Package.marked_keep" title="Permalink to this definition">¶</a></dt>
<dd><p>Return <tt class="docutils literal"><span class="pre">True</span></tt> if the package is marked for keep.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Package.marked_reinstall">
<tt class="descname">marked_reinstall</tt><a class="headerlink" href="#apt.package.Package.marked_reinstall" title="Permalink to this definition">¶</a></dt>
<dd><p>Return <tt class="docutils literal"><span class="pre">True</span></tt> if the package is marked for reinstall.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Package.marked_upgrade">
<tt class="descname">marked_upgrade</tt><a class="headerlink" href="#apt.package.Package.marked_upgrade" title="Permalink to this definition">¶</a></dt>
<dd><p>Return <tt class="docutils literal"><span class="pre">True</span></tt> if the package is marked for upgrade.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Package.name">
<tt class="descname">name</tt><a class="headerlink" href="#apt.package.Package.name" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the name of the package, possibly including architecture.</p>
<p>If the package is not part of the system’s preferred architecture,
return the same as <a class="reference internal" href="#apt.package.Package.fullname" title="apt.package.Package.fullname"><tt class="xref py py-attr docutils literal"><span class="pre">fullname</span></tt></a>, otherwise return the same
as <a class="reference internal" href="#apt.package.Package.shortname" title="apt.package.Package.shortname"><tt class="xref py py-attr docutils literal"><span class="pre">shortname</span></tt></a></p>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 0.7.100.3.</span></p>
</div>
<p>As part of multi-arch, this field now may include architecture
information.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Package.section">
<tt class="descname">section</tt><a class="headerlink" href="#apt.package.Package.section" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the section of the package.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Package.shortname">
<tt class="descname">shortname</tt><a class="headerlink" href="#apt.package.Package.shortname" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the name of the package, without architecture.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.7.100.3.</span></p>
</div>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Package.versions">
<tt class="descname">versions</tt><a class="headerlink" href="#apt.package.Package.versions" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a VersionList() object for all available versions.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.7.9.</span></p>
</div>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="the-version-class">
<h2>The Version class<a class="headerlink" href="#the-version-class" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="apt.package.Version">
<em class="property">class </em><tt class="descclassname">apt.package.</tt><tt class="descname">Version</tt><big>(</big><em>package</em>, <em>cand</em><big>)</big><a class="headerlink" href="#apt.package.Version" title="Permalink to this definition">¶</a></dt>
<dd><p>Representation of a package version.</p>
<p>The Version class contains all information related to a
specific package version.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.7.9.</span></p>
</div>
<dl class="attribute">
<dt id="apt.package.Version.architecture">
<tt class="descname">architecture</tt><a class="headerlink" href="#apt.package.Version.architecture" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the architecture of the package version.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Version.dependencies">
<tt class="descname">dependencies</tt><a class="headerlink" href="#apt.package.Version.dependencies" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the dependencies of the package version.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Version.description">
<tt class="descname">description</tt><a class="headerlink" href="#apt.package.Version.description" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the formatted long description.</p>
<p>Return the formatted long description according to the Debian policy
(Chapter 5.6.13).
See <a class="reference external" href="http://www.debian.org/doc/debian-policy/ch-controlfields.html">http://www.debian.org/doc/debian-policy/ch-controlfields.html</a>
for more information.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Version.downloadable">
<tt class="descname">downloadable</tt><a class="headerlink" href="#apt.package.Version.downloadable" title="Permalink to this definition">¶</a></dt>
<dd><p>Return whether the version of the package is downloadable.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Version.enhances">
<tt class="descname">enhances</tt><a class="headerlink" href="#apt.package.Version.enhances" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the list of enhances for the package version.</p>
</dd></dl>
<dl class="method">
<dt id="apt.package.Version.fetch_binary">
<tt class="descname">fetch_binary</tt><big>(</big><em>destdir=''</em>, <em>progress=None</em><big>)</big><a class="headerlink" href="#apt.package.Version.fetch_binary" title="Permalink to this definition">¶</a></dt>
<dd><p>Fetch the binary version of the package.</p>
<p>The parameter <em>destdir</em> specifies the directory where the package will
be fetched to.</p>
<p>The parameter <em>progress</em> may refer to an apt_pkg.AcquireProgress()
object. If not specified or None, apt.progress.text.AcquireProgress()
is used.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.7.10.</span></p>
</div>
</dd></dl>
<dl class="method">
<dt id="apt.package.Version.fetch_source">
<tt class="descname">fetch_source</tt><big>(</big><em>destdir=''</em>, <em>progress=None</em>, <em>unpack=True</em><big>)</big><a class="headerlink" href="#apt.package.Version.fetch_source" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the source code of a package.</p>
<p>The parameter <em>destdir</em> specifies the directory where the source will
be fetched to.</p>
<p>The parameter <em>progress</em> may refer to an apt_pkg.AcquireProgress()
object. If not specified or None, apt.progress.text.AcquireProgress()
is used.</p>
<p>The parameter <em>unpack</em> describes whether the source should be unpacked
(<tt class="docutils literal"><span class="pre">True</span></tt>) or not (<tt class="docutils literal"><span class="pre">False</span></tt>). By default, it is unpacked.</p>
<p>If <em>unpack</em> is <tt class="docutils literal"><span class="pre">True</span></tt>, the path to the extracted directory is
returned. Otherwise, the path to the .dsc file is returned.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Version.filename">
<tt class="descname">filename</tt><a class="headerlink" href="#apt.package.Version.filename" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the path to the file inside the archive.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.7.10.</span></p>
</div>
</dd></dl>
<dl class="method">
<dt id="apt.package.Version.get_dependencies">
<tt class="descname">get_dependencies</tt><big>(</big><em>*types</em><big>)</big><a class="headerlink" href="#apt.package.Version.get_dependencies" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a list of Dependency objects for the given types.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Version.homepage">
<tt class="descname">homepage</tt><a class="headerlink" href="#apt.package.Version.homepage" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the homepage for the package.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Version.installed_size">
<tt class="descname">installed_size</tt><a class="headerlink" href="#apt.package.Version.installed_size" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the size of the package when installed.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Version.md5">
<tt class="descname">md5</tt><a class="headerlink" href="#apt.package.Version.md5" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the md5sum of the binary.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.7.10.</span></p>
</div>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Version.origins">
<tt class="descname">origins</tt><a class="headerlink" href="#apt.package.Version.origins" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a list of origins for the package version.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Version.policy_priority">
<tt class="descname">policy_priority</tt><a class="headerlink" href="#apt.package.Version.policy_priority" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the internal policy priority as a number.
See apt_preferences(5) for more information about what it means.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Version.priority">
<tt class="descname">priority</tt><a class="headerlink" href="#apt.package.Version.priority" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the priority of the package, as string.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Version.provides">
<tt class="descname">provides</tt><a class="headerlink" href="#apt.package.Version.provides" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a list of names that this version provides.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Version.raw_description">
<tt class="descname">raw_description</tt><a class="headerlink" href="#apt.package.Version.raw_description" title="Permalink to this definition">¶</a></dt>
<dd><p>return the long description (raw).</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Version.recommends">
<tt class="descname">recommends</tt><a class="headerlink" href="#apt.package.Version.recommends" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the recommends of the package version.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Version.record">
<tt class="descname">record</tt><a class="headerlink" href="#apt.package.Version.record" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a Record() object for this version.</p>
<p>Return a Record() object for this version which provides access
to the raw attributes of the candidate version</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Version.section">
<tt class="descname">section</tt><a class="headerlink" href="#apt.package.Version.section" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the section of the package.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Version.sha1">
<tt class="descname">sha1</tt><a class="headerlink" href="#apt.package.Version.sha1" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the sha1sum of the binary.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.7.10.</span></p>
</div>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Version.sha256">
<tt class="descname">sha256</tt><a class="headerlink" href="#apt.package.Version.sha256" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the sha256sum of the binary.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.7.10.</span></p>
</div>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Version.size">
<tt class="descname">size</tt><a class="headerlink" href="#apt.package.Version.size" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the size of the package.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Version.source_name">
<tt class="descname">source_name</tt><a class="headerlink" href="#apt.package.Version.source_name" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the name of the source package.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Version.source_version">
<tt class="descname">source_version</tt><a class="headerlink" href="#apt.package.Version.source_version" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the version of the source package.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Version.suggests">
<tt class="descname">suggests</tt><a class="headerlink" href="#apt.package.Version.suggests" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the suggests of the package version.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Version.summary">
<tt class="descname">summary</tt><a class="headerlink" href="#apt.package.Version.summary" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the short description (one line summary).</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Version.tasks">
<tt class="descname">tasks</tt><a class="headerlink" href="#apt.package.Version.tasks" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the tasks of the package.</p>
<p>A set of the names of the tasks this package belongs to.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.8.0.</span></p>
</div>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Version.uri">
<tt class="descname">uri</tt><a class="headerlink" href="#apt.package.Version.uri" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a single URI for the binary.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.7.10.</span></p>
</div>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Version.uris">
<tt class="descname">uris</tt><a class="headerlink" href="#apt.package.Version.uris" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a list of all available uris for the binary.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.7.10.</span></p>
</div>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Version.version">
<tt class="descname">version</tt><a class="headerlink" href="#apt.package.Version.version" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the version as a string.</p>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="dependency-information">
<h2>Dependency Information<a class="headerlink" href="#dependency-information" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="apt.package.BaseDependency">
<em class="property">class </em><tt class="descclassname">apt.package.</tt><tt class="descname">BaseDependency</tt><big>(</big><em>dep</em><big>)</big><a class="headerlink" href="#apt.package.BaseDependency" title="Permalink to this definition">¶</a></dt>
<dd><p>A single dependency.</p>
<dl class="attribute">
<dt id="apt.package.BaseDependency.name">
<tt class="descname">name</tt><a class="headerlink" href="#apt.package.BaseDependency.name" title="Permalink to this definition">¶</a></dt>
<dd><p>The name of the target package.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.BaseDependency.pre_depend">
<tt class="descname">pre_depend</tt><a class="headerlink" href="#apt.package.BaseDependency.pre_depend" title="Permalink to this definition">¶</a></dt>
<dd><p>Whether this is a PreDepends.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.BaseDependency.rawtype">
<tt class="descname">rawtype</tt><a class="headerlink" href="#apt.package.BaseDependency.rawtype" title="Permalink to this definition">¶</a></dt>
<dd><p>Type of the dependency.</p>
<p>This should be one of ‘Breaks’, ‘Conflicts’, ‘Depends’, ‘Enhances’,
‘PreDepends’, ‘Recommends’, ‘Replaces’, ‘Suggests’.</p>
<p>Additional types might be added in the future.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.BaseDependency.relation">
<tt class="descname">relation</tt><a class="headerlink" href="#apt.package.BaseDependency.relation" title="Permalink to this definition">¶</a></dt>
<dd><p>The relation (<, <=, !=, =, >=, >, ).</p>
<p>Note that the empty string is a valid string as well, if no version
is specified.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.BaseDependency.version">
<tt class="descname">version</tt><a class="headerlink" href="#apt.package.BaseDependency.version" title="Permalink to this definition">¶</a></dt>
<dd><p>The target version or None.</p>
<p>It is None if and only if relation is the empty string.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="apt.package.Dependency">
<em class="property">class </em><tt class="descclassname">apt.package.</tt><tt class="descname">Dependency</tt><a class="headerlink" href="#apt.package.Dependency" title="Permalink to this definition">¶</a></dt>
<dd><p>The dependency class represents a Or-Group of dependencies. It provides
an attribute to access the <a class="reference internal" href="#apt.package.BaseDependency" title="apt.package.BaseDependency"><tt class="xref py py-class docutils literal"><span class="pre">BaseDependency</span></tt></a> object for the available
choices.</p>
<dl class="attribute">
<dt id="apt.package.Dependency.or_dependencies">
<tt class="descname">or_dependencies</tt><a class="headerlink" href="#apt.package.Dependency.or_dependencies" title="Permalink to this definition">¶</a></dt>
<dd><p>A list of <a class="reference internal" href="#apt.package.BaseDependency" title="apt.package.BaseDependency"><tt class="xref py py-class docutils literal"><span class="pre">BaseDependency</span></tt></a> objects which could satisfy the
requirement of the Or-Group.</p>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="origin-information">
<h2>Origin Information<a class="headerlink" href="#origin-information" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="apt.package.Origin">
<em class="property">class </em><tt class="descclassname">apt.package.</tt><tt class="descname">Origin</tt><a class="headerlink" href="#apt.package.Origin" title="Permalink to this definition">¶</a></dt>
<dd><p>The <a class="reference internal" href="#apt.package.Origin" title="apt.package.Origin"><tt class="xref py py-class docutils literal"><span class="pre">Origin</span></tt></a> class provides access to the origin of the package.
It allows you to check the component, archive, the hostname, and even if
this package can be trusted.</p>
<dl class="attribute">
<dt id="apt.package.Origin.archive">
<tt class="descname">archive</tt><a class="headerlink" href="#apt.package.Origin.archive" title="Permalink to this definition">¶</a></dt>
<dd><p>The archive (eg. unstable)</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Origin.component">
<tt class="descname">component</tt><a class="headerlink" href="#apt.package.Origin.component" title="Permalink to this definition">¶</a></dt>
<dd><p>The component (eg. main)</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Origin.label">
<tt class="descname">label</tt><a class="headerlink" href="#apt.package.Origin.label" title="Permalink to this definition">¶</a></dt>
<dd><p>The Label, as set in the Release file</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Origin.origin">
<tt class="descname">origin</tt><a class="headerlink" href="#apt.package.Origin.origin" title="Permalink to this definition">¶</a></dt>
<dd><p>The Origin, as set in the Release file</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Origin.site">
<tt class="descname">site</tt><a class="headerlink" href="#apt.package.Origin.site" title="Permalink to this definition">¶</a></dt>
<dd><p>The hostname of the site.</p>
</dd></dl>
<dl class="attribute">
<dt id="apt.package.Origin.trusted">
<tt class="descname">trusted</tt><a class="headerlink" href="#apt.package.Origin.trusted" title="Permalink to this definition">¶</a></dt>
<dd><p>Boolean value whether this is trustworthy. An origin can be trusted, if
it provides a GPG-signed Release file and the GPG-key used is in the
keyring used by apt (see apt-key).</p>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="the-record-class">
<h2>The Record class<a class="headerlink" href="#the-record-class" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="apt.package.Record">
<em class="property">class </em><tt class="descclassname">apt.package.</tt><tt class="descname">Record</tt><big>(</big><em>record_str</em><big>)</big><a class="headerlink" href="#apt.package.Record" title="Permalink to this definition">¶</a></dt>
<dd><p>Record in a Packages file</p>
<p>Represent a record as stored in a Packages file. You can use this like
a dictionary mapping the field names of the record to their values:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">record</span> <span class="o">=</span> <span class="n">Record</span><span class="p">(</span><span class="s">"Package: python-apt</span><span class="se">\n</span><span class="s">Version: 0.8.0</span><span class="se">\n\n</span><span class="s">"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">record</span><span class="p">[</span><span class="s">"Package"</span><span class="p">]</span>
<span class="go">'python-apt'</span>
<span class="gp">>>> </span><span class="n">record</span><span class="p">[</span><span class="s">"Version"</span><span class="p">]</span>
<span class="go">'0.8.0'</span>
</pre></div>
</div>
<p>For example, to get the tasks of a package from a cache, you could do:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">package</span><span class="o">.</span><span class="n">candidate</span><span class="o">.</span><span class="n">record</span><span class="p">[</span><span class="s">"Tasks"</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">()</span>
</pre></div>
</div>
<p>Of course, you can also use the <a class="reference internal" href="#apt.package.Version.tasks" title="apt.package.Version.tasks"><tt class="xref py py-attr docutils literal"><span class="pre">Version.tasks</span></tt></a> property.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<div class="last versionchanged">
<p><span class="versionmodified">Changed in version 0.7.100: </span>This class is a subclass of <a class="reference external" href="http://docs.python.org/library/collections.html#collections.Mapping" title="(in Python v2.7)"><tt class="xref py py-class docutils literal"><span class="pre">collections.Mapping</span></tt></a> when used
in Python 2.6 or newer.</p>
</div>
</div>
<dl class="describe">
<dt>
<tt class="descname">record[name]</tt></dt>
<dd><p>Return the value of the field with the name <em>name</em>.</p>
</dd></dl>
<dl class="describe">
<dt>
<tt class="descname">name in record</tt></dt>
<dd><p>Return whether a field <em>name</em> exists in record.</p>
</dd></dl>
<dl class="describe">
<dt>
<tt class="descname">len(record)</tt></dt>
<dd><p>The number of fields in the record</p>
</dd></dl>
<dl class="describe">
<dt>
<tt class="descname">str(record)</tt></dt>
<dd><p>Display the record as a string</p>
</dd></dl>
<dl class="method">
<dt id="apt.package.Record.get">
<tt class="descname">get</tt><big>(</big><em>key</em>, <em>default=None</em><big>)</big><a class="headerlink" href="#apt.package.Record.get" title="Permalink to this definition">¶</a></dt>
<dd><p>Return record[key] if key in record, else <em>default</em>.</p>
<p>The parameter <em>default</em> must be either a string or None.</p>
</dd></dl>
<dl class="method">
<dt id="apt.package.Record.has_key">
<tt class="descname">has_key</tt><big>(</big><em>key</em><big>)</big><a class="headerlink" href="#apt.package.Record.has_key" title="Permalink to this definition">¶</a></dt>
<dd><p>deprecated form of <tt class="docutils literal"><span class="pre">key</span> <span class="pre">in</span> <span class="pre">x</span></tt>.</p>
</dd></dl>
<dl class="method">
<dt id="apt.package.Record.iteritems">
<tt class="descname">iteritems</tt><big>(</big><big>)</big><a class="headerlink" href="#apt.package.Record.iteritems" title="Permalink to this definition">¶</a></dt>
<dd><p>An iterator over the (key, value) items of the record.</p>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h2>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">apt</span>
<span class="n">cache</span> <span class="o">=</span> <span class="n">apt</span><span class="o">.</span><span class="n">Cache</span><span class="p">()</span>
<span class="n">pkg</span> <span class="o">=</span> <span class="n">cache</span><span class="p">[</span><span class="s">'python-apt'</span><span class="p">]</span> <span class="c"># Access the Package object for python-apt</span>
<span class="k">print</span> <span class="s">'python-apt is trusted:'</span><span class="p">,</span> <span class="n">pkg</span><span class="o">.</span><span class="n">candidate</span><span class="o">.</span><span class="n">origins</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">trusted</span>
<span class="c"># Mark python-apt for install</span>
<span class="n">pkg</span><span class="o">.</span><span class="n">mark_install</span><span class="p">()</span>
<span class="k">print</span> <span class="s">'python-apt is marked for install:'</span><span class="p">,</span> <span class="n">pkg</span><span class="o">.</span><span class="n">marked_install</span>
<span class="k">print</span> <span class="s">'python-apt is (summary):'</span><span class="p">,</span> <span class="n">pkg</span><span class="o">.</span><span class="n">candidate</span><span class="o">.</span><span class="n">summary</span>
<span class="c"># Now, really install it</span>
<span class="n">cache</span><span class="o">.</span><span class="n">commit</span><span class="p">()</span>
</pre></div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="../contents.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#"><tt class="docutils literal"><span class="pre">apt.package</span></tt> — Classes for package handling</a><ul>
<li><a class="reference internal" href="#the-package-class">The Package class</a></li>
<li><a class="reference internal" href="#the-version-class">The Version class</a></li>
<li><a class="reference internal" href="#dependency-information">Dependency Information</a></li>
<li><a class="reference internal" href="#origin-information">Origin Information</a></li>
<li><a class="reference internal" href="#the-record-class">The Record class</a></li>
<li><a class="reference internal" href="#examples">Examples</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="apt.debfile.html"
title="previous chapter"><tt class="docutils literal"><span class="pre">apt.debfile</span></tt> — Classes related to debian package files</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="apt.progress.base.html"
title="next chapter"><tt class="docutils literal"><span class="pre">apt.progress.base</span></tt> — Abstract classes for progress reporting</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/library/apt.package.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="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="apt.progress.base.html" title="apt.progress.base — Abstract classes for progress reporting"
>next</a> |</li>
<li class="right" >
<a href="apt.debfile.html" title="apt.debfile — Classes related to debian package files"
>previous</a> |</li>
<li><img src="../_static/py.png" alt=""
style="vertical-align: middle; margin-top: -1px"/></li>
<li><a href="../index.html">python-apt 0.9.3.12 documentation</a> »</li>
<li><a href="index.html" >Python APT Library</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2009-2010, Julian Andres Klode <jak@debian.org>.
Last updated on Jun 20, 2015.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
</div>
</body>
</html>
|