debian.debian_support module¶
Facilities to deal with Debian-specific metadata
-
class
debian.debian_support.
AptPkgVersion
(version)¶ Bases:
debian.debian_support.BaseVersion
Represents a Debian package version, using apt_pkg.VersionCompare
-
_compare
(other)¶
-
-
class
debian.debian_support.
BaseVersion
(version)¶ Bases:
object
Base class for classes representing Debian versions
It doesn’t implement any comparison, but it does check for valid versions according to Section 5.6.12 in the Debian Policy Manual. Since splitting the version into epoch, upstream_version, and debian_revision components is pretty much free with the validation, it sets those fields as properties of the object, and sets the raw version to the full_version property. A missing epoch or debian_revision results in the respective property set to None. Setting any of the properties results in the full_version being recomputed and the rest of the properties set from that.
It also implements __str__, just returning the raw version given to the initializer.
-
_compare
(other)¶
-
_set_full_version
(version)¶
-
_update_full_version
()¶
-
magic_attrs
= ('full_version', 'epoch', 'upstream_version', 'debian_revision', 'debian_version')¶
-
re_valid_version
= re.compile('^((?P<epoch>\\d+):)?(?P<upstream_version>[A-Za-z0-9.+:~-]+?)(-(?P<debian_revision>[A-Za-z0-9+.~]+))?$')¶
-
-
class
debian.debian_support.
NativeVersion
(version)¶ Bases:
debian.debian_support.BaseVersion
Represents a Debian package version, with native Python comparison
-
_compare
(other)¶
-
classmethod
_order
(x)¶ Return an integer value for character x
-
classmethod
_version_cmp_part
(va, vb)¶
-
classmethod
_version_cmp_string
(va, vb)¶
-
re_all_digits_or_not
= re.compile('\\d+|\\D+')¶
-
re_alpha
= re.compile('[A-Za-z]')¶
-
re_digit
= re.compile('\\d')¶
-
re_digits
= re.compile('\\d+')¶
-
-
class
debian.debian_support.
PackageFile
(name, file_obj=None)¶ Bases:
object
A Debian package file.
Objects of this class can be used to read Debian’s Source and Packages files.
-
raiseSyntaxError
(*args, **kwargs)¶
-
raise_syntax_error
(msg, lineno=None)¶
-
re_continuation
= re.compile('^\\s+(?:\\.|(\\S.*?)\\s*)$')¶
-
re_field
= re.compile('^([A-Za-z][A-Za-z0-9-_]+):(?:\\s*(.*?))?\\s*$')¶
-
-
exception
debian.debian_support.
ParseError
(filename, lineno, msg)¶ Bases:
Exception
An exception which is used to signal a parse failure.
Attributes:
filename - name of the file lineno - line number in the file msg - error message
-
printOut
(*args, **kwargs)¶
-
print_out
(file)¶ Writes a machine-parsable error message to file.
-
-
class
debian.debian_support.
PseudoEnum
(name, order)¶ Bases:
object
A base class for types which resemble enumeration types.
-
class
debian.debian_support.
Release
(name, order)¶ Bases:
debian.debian_support.PseudoEnum
-
releases
= {'potato': Release('potato'), 'stretch': Release('stretch'), 'wheezy': Release('wheezy'), 'lenny': Release('lenny'), 'bullseye': Release('bullseye'), 'bo': Release('bo'), 'slink': Release('slink'), 'woody': Release('woody'), 'squeeze': Release('squeeze'), 'buster': Release('buster'), 'rex': Release('rex'), 'sarge': Release('sarge'), 'jessie': Release('jessie'), 'sid': Release('sid'), 'buzz': Release('buzz'), 'hamm': Release('hamm'), 'etch': Release('etch')}¶
-
-
class
debian.debian_support.
Version
(version)¶
-
debian.debian_support.
download_file
(remote, local)¶ Copies a gzipped remote file to the local system.
remote - URL, without the .gz suffix local - name of the local file
-
debian.debian_support.
download_gunzip_lines
(remote)¶ Downloads a file from a remote location and gunzips it.
Returns the lines in the file.
-
debian.debian_support.
intern_release
(name, releases=None)¶
-
debian.debian_support.
merge_as_sets
(*args)¶ Create an order set (represented as a list) of the objects in the sequences passed as arguments.
-
debian.debian_support.
patch_lines
(lines, patches)¶ Applies patches to lines. Updates lines in place.
-
debian.debian_support.
patches_from_ed_script
(source, re_cmd=None)¶ Converts source to a stream of patches.
Patches are triples of line indexes:
- number of the first line to be replaced
- one plus the number of the last line to be replaced
- list of line replacements
This is enough to model arbitrary additions, deletions and replacements.
-
debian.debian_support.
read_lines_sha1
(lines)¶
-
debian.debian_support.
replace_file
(lines, local)¶
-
debian.debian_support.
update_file
(remote, local, verbose=None)¶ Updates the local file by downloading a remote patch.
Returns a list of lines in the local file.
-
debian.debian_support.
version_compare
(a, b)¶