apt.debfile — Classes related to debian package files¶

The apt.debfile provides classes to work with locally available debian packages, or source packages.

Binary packages¶

class apt.debfile.DebPackage(filename: str | None = None, cache: Cache | None = None)¶

A Debian Package (.deb file).

The DebPackage class is a class for working with ‘.deb’ files, also known as Debian packages.

It provides methods and attributes to get a list of the files in the package, to install the package and much more.

If you specify cache it has to point to an apt.cache.Cache() object.

Changed in version 0.7.9: Introduce all new methods (everything except for open() and filelist)

VERSION_NEWER = 3¶
VERSION_NONE = 0¶
VERSION_OUTDATED = 1¶
VERSION_SAME = 2¶
check(allow_downgrade: bool = False) → bool¶

Check if the package is installable.

check_breaks_existing_packages() → bool¶

check if installing the package would break exsisting package on the system, e.g. system has: smc depends on smc-data (= 1.4) and user tries to installs smc-data 1.6

check_conflicts() → bool¶

Check if there are conflicts with existing or selected packages.

Check if the package conflicts with a existing or to be installed package. Return True if the pkg is OK.

compare_to_version_in_cache(use_installed: bool = True) → int¶

Compare the package to the version available in the cache.

Checks if the package is already installed or availabe in the cache and if so in what version, returns one of (VERSION_NONE, VERSION_OUTDATED, VERSION_SAME, VERSION_NEWER).

property conflicts: list[list[tuple[str, str, str]]]¶

List of packages conflicting with this package.

control_content(name: str) → str¶

return the content of a specific control.tar.gz file

property control_filelist: list[str]¶

return the list of files in control.tar.gz

data_content(name: str) → str¶

return the content of a specific control.tar.gz file

debug = 0¶
property depends: list[list[tuple[str, str, str]]]¶

List of packages on which this package depends on.

property filelist: list[str]¶

return the list of files in the deb.

install(install_progress: InstallProgress | None = None) → int¶

Install the package.

property missing_deps: list[str]¶

Return missing dependencies.

open(filename: str) → None¶

open given debfile

property provides: list[list[tuple[str, str, str]]]¶

List of virtual packages which are provided by this package.

property replaces: list[list[tuple[str, str, str]]]¶

List of packages which are replaced by this package.

replaces_real_pkg(pkgname: str, oper: str, ver: str) → bool¶

Return True if a given non-virtual package is replaced.

Return True if the deb packages replaces a real (not virtual) packages named (pkgname, oper, ver).

property required_changes: tuple[list[str], list[str], list[str]]¶

Get the changes required to satisfy the dependencies.

Returns: a tuple with (install, remove, unauthenticated)

satisfy_depends_str(dependsstr: str) → bool¶

Satisfy the dependencies in the given string.

static to_hex(in_data: str) → str¶
static to_strish(in_data: str | Iterable[int]) → str¶

Source packages¶

class apt.debfile.DscSrcPackage(filename: str | None = None, cache: Cache | None = None)¶

A locally available source package.

Provide functionality to work with locally available source packages, especially with their ‘.dsc’ file.

Added in version 0.7.9.

VERSION_NEWER = 3¶
VERSION_NONE = 0¶
VERSION_OUTDATED = 1¶
VERSION_SAME = 2¶
check(allow_downgrade: bool = False) → bool¶

Check if the package is installable.

The second parameter is ignored and only exists for compatibility with parent type.

check_breaks_existing_packages() → bool¶

check if installing the package would break exsisting package on the system, e.g. system has: smc depends on smc-data (= 1.4) and user tries to installs smc-data 1.6

check_conflicts() → bool¶

Check if there are conflicts with existing or selected packages.

Check if the package conflicts with a existing or to be installed package. Return True if the pkg is OK.

compare_to_version_in_cache(use_installed: bool = True) → int¶

Compare the package to the version available in the cache.

Checks if the package is already installed or availabe in the cache and if so in what version, returns one of (VERSION_NONE, VERSION_OUTDATED, VERSION_SAME, VERSION_NEWER).

property conflicts: list[list[tuple[str, str, str]]]¶

Return the dependencies of the package

control_content(name: str) → str¶

return the content of a specific control.tar.gz file

property control_filelist: list[str]¶

return the list of files in control.tar.gz

data_content(name: str) → str¶

return the content of a specific control.tar.gz file

debug = 0¶
property depends: list[list[tuple[str, str, str]]]¶

Return the dependencies of the package

property filelist: list[str]¶

Return the list of files associated with this dsc file

filename: str | None¶
install(install_progress: InstallProgress | None = None) → int¶

Install the package.

property missing_deps: list[str]¶

Return missing dependencies.

open(file: str) → None¶

Open the package.

property provides: list[list[tuple[str, str, str]]]¶

List of virtual packages which are provided by this package.

property replaces: list[list[tuple[str, str, str]]]¶

List of packages which are replaced by this package.

replaces_real_pkg(pkgname: str, oper: str, ver: str) → bool¶

Return True if a given non-virtual package is replaced.

Return True if the deb packages replaces a real (not virtual) packages named (pkgname, oper, ver).

property required_changes: tuple[list[str], list[str], list[str]]¶

Get the changes required to satisfy the dependencies.

Returns: a tuple with (install, remove, unauthenticated)

satisfy_depends_str(dependsstr: str) → bool¶

Satisfy the dependencies in the given string.

static to_hex(in_data: str) → str¶
static to_strish(in_data: str | Iterable[int]) → str¶

python-apt

Navigation

  • What’s new in python-apt
  • Python APT Library
    • apt_pkg — The low-level bindings for apt-pkg
    • apt_inst - Working with local Debian packages
    • apt.cache — The Cache class
    • apt.cdrom - Functionality like in apt-cdrom
    • apt.debfile — Classes related to debian package files
      • Binary packages
        • DebPackage
          • DebPackage.VERSION_NEWER
          • DebPackage.VERSION_NONE
          • DebPackage.VERSION_OUTDATED
          • DebPackage.VERSION_SAME
          • DebPackage.check()
          • DebPackage.check_breaks_existing_packages()
          • DebPackage.check_conflicts()
          • DebPackage.compare_to_version_in_cache()
          • DebPackage.conflicts
          • DebPackage.control_content()
          • DebPackage.control_filelist
          • DebPackage.data_content()
          • DebPackage.debug
          • DebPackage.depends
          • DebPackage.filelist
          • DebPackage.install()
          • DebPackage.missing_deps
          • DebPackage.open()
          • DebPackage.provides
          • DebPackage.replaces
          • DebPackage.replaces_real_pkg()
          • DebPackage.required_changes
          • DebPackage.satisfy_depends_str()
          • DebPackage.to_hex()
          • DebPackage.to_strish()
      • Source packages
        • DscSrcPackage
          • DscSrcPackage.VERSION_NEWER
          • DscSrcPackage.VERSION_NONE
          • DscSrcPackage.VERSION_OUTDATED
          • DscSrcPackage.VERSION_SAME
          • DscSrcPackage.check()
          • DscSrcPackage.check_breaks_existing_packages()
          • DscSrcPackage.check_conflicts()
          • DscSrcPackage.compare_to_version_in_cache()
          • DscSrcPackage.conflicts
          • DscSrcPackage.control_content()
          • DscSrcPackage.control_filelist
          • DscSrcPackage.data_content()
          • DscSrcPackage.debug
          • DscSrcPackage.depends
          • DscSrcPackage.filelist
          • DscSrcPackage.filename
          • DscSrcPackage.install()
          • DscSrcPackage.missing_deps
          • DscSrcPackage.open()
          • DscSrcPackage.provides
          • DscSrcPackage.replaces
          • DscSrcPackage.replaces_real_pkg()
          • DscSrcPackage.required_changes
          • DscSrcPackage.satisfy_depends_str()
          • DscSrcPackage.to_hex()
          • DscSrcPackage.to_strish()
    • apt.package — Classes for package handling
    • apt.progress.base — Abstract classes for progress reporting
    • apt.progress.text — Progress reporting for text interfaces
    • aptsources.distinfo — provide meta information for distro repositories
    • aptsources.distro — Distribution abstraction of the sources.list
    • aptsources.sourceslist — Provide an abstraction of the sources.list
  • Tutorials
  • Python APT and C++

Related Topics

  • Documentation overview
    • Python APT Library
      • Previous: apt.cdrom - Functionality like in apt-cdrom
      • Next: apt.package — Classes for package handling

Quick search

©2009-2010, Julian Andres Klode . | Powered by Sphinx 8.1.3 & Alabaster 0.7.16 | Page source