debian.watch module¶
Functions for working with watch files.
-
exception
debian.watch.
MissingVersion
¶ Bases:
Exception
The version= line is missing.
-
class
debian.watch.
Watch
(url, matching_pattern=None, version=None, script=None, opts=None)¶ Bases:
object
Watch line entry.
This will contain the attributes documented in uscan(1):
- Variables
url – The URL (possibly including the filename regex)
matching_pattern – a filename regex, optional
version – version policy, optional
script – script to run, optional
opts – a list of options, as strings
-
class
debian.watch.
WatchFile
(entries=None, options=None, version=4)¶ Bases:
object
A Debian watch file.
- Variables
entries – list of Watch entries
options – optional list of global options, applied to all Watch entries
version – watch file version
-
dump
(f: TextIO) → None¶ Write the contents of a watch file to a file-like object.
Note that this will not preserve the formatting of the original file, and thus it is currently not possible to use this function to parse and reserialize a file and end up with the same contents.
- Parameters
f – File-like object to write to
-
classmethod
from_lines
(lines: Iterable[str], strict: bool = False) → Optional[debian.watch.WatchFile]¶ Parse from the contents that make up a watch file.
- Parameters
lines – watch file lines to parse
- Returns
instance or None if there are no non-comment lines in the file
- Raises
MissingVersion – if there is no version number declared
ValueError – when syntax errors are encountered
-
exception
debian.watch.
WatchFileFormatError
¶ Bases:
ValueError
Raised when the input is not valid.
-
debian.watch.
_complain
(msg: str, strict: bool) → None¶
-
debian.watch.
expand
(text: str, package: str) → str¶ Apply substitutions to a string.
- Parameters
text – text to apply substitutions to
package – package name, as a string
- Returns
text with subsitutions applied