home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / doc / python-apt / html / _sources / apt / package.txt < prev    next >
Encoding:
Text File  |  2009-03-30  |  2.3 KB  |  102 lines

  1. :mod:`apt.package` --- Classes for package handling
  2. ====================================================
  3.  
  4.  
  5. .. automodule:: apt.package
  6.  
  7.  
  8. The Package class
  9. -----------------
  10. .. autoclass:: Package
  11.     :members:
  12.  
  13.  
  14. Dependency Information
  15. ----------------------
  16. .. class:: BaseDependency
  17.  
  18.     The :class:`BaseDependency` class defines various attributes for accessing
  19.     the parts of a dependency. The attributes are as follows:
  20.  
  21.     .. attribute:: name
  22.  
  23.         The name of the dependency
  24.  
  25.     .. attribute:: relation
  26.  
  27.         The relation (>>,>=,==,<<,<=,)
  28.  
  29.     .. attribute:: version
  30.  
  31.         The version or None.
  32.  
  33.     .. attribute:: preDepend
  34.  
  35.         Boolean value whether this is a pre-dependency.
  36.  
  37. .. class:: Dependency
  38.  
  39.     The dependency class represents a Or-Group of dependencies. It provides
  40.     an attribute to access the :class:`BaseDependency` object for the available
  41.     choices.
  42.  
  43.     .. attribute:: or_dependencies
  44.  
  45.         A list of :class:`BaseDependency` objects which could satisfy the
  46.         requirement of the Or-Group.
  47.  
  48.  
  49. Origin Information
  50. -------------------
  51. .. class:: Origin
  52.  
  53.     The :class:`Origin` class provides access to the origin of the package.
  54.     It allows you to check the component, archive, the hostname, and even if
  55.     this package can be trusted.
  56.  
  57.     .. attribute:: archive
  58.  
  59.         The archive (eg. unstable)
  60.  
  61.     .. attribute:: component
  62.  
  63.         The component (eg. main)
  64.  
  65.     .. attribute:: label
  66.  
  67.         The Label, as set in the Release file
  68.  
  69.     .. attribute:: origin
  70.  
  71.         The Origin, as set in the Release file
  72.  
  73.     .. attribute:: site
  74.  
  75.         The hostname of the site.
  76.  
  77.     .. attribute:: trusted
  78.  
  79.        Boolean value whether this is trustworthy. An origin can be trusted, if
  80.        it provides a GPG-signed Release file and the GPG-key used is in the
  81.        keyring used by apt (see apt-key).
  82.  
  83. Examples
  84. ---------
  85. .. code-block:: python
  86.  
  87.     import apt
  88.  
  89.     cache = apt.Cache()
  90.     pkg = cache['python-apt'] # Access the Package object for python-apt
  91.     print 'python-apt is trusted:', pkg.candidateOrigin.trusted
  92.  
  93.     # Mark python-apt for install
  94.     pkg.markInstall()
  95.  
  96.     print 'python-apt is marked for install:', pkg.markedInstall
  97.  
  98.     print 'python-apt is', pkg.summary #Python interface to libapt-pkg
  99.  
  100.     # Now, really install it
  101.     cache.commit()
  102.