# `gbp.deb.uscan.Uscan(object)` class documentation

Part of `gbp.deb.uscan` (View In Hierarchy)
Undocumented

Class Variable | cmd | Undocumented
Method | __init__ | Undocumented
Method | uptodate | Undocumented
Method | tarball | Undocumented
Method | scan | Invoke uscan to fetch a new upstream version
Instance Variable | _uptodate | Undocumented
Instance Variable | _tarball | Undocumented
Instance Variable | _dir | Undocumented
Method | _parse | Parse the uscan output return and update the object's properties
Method | _parse_uptodate | Check if the uscan reports that we're up to date.
Method | _raise_error | Parse the uscan output for errors and warnings and raise a `UscanError` exception based on this. If no error detail is found a generic error message is used.

cmd =
Undocumented
(type: `str`)
def __init__(self, dir="""."""):
Undocumented
_uptodate =
Undocumented
(type: `bool`)
_tarball =
Undocumented
_dir =
Undocumented
@property
def uptodate(self):
Undocumented
@property
def tarball(self):
Undocumented
def _parse(self, out):

Parse the uscan output return and update the object's properties

Parameters

out

uscan output (type: string

    >>> u = Uscan('http://example.com/')
    >>> u._parse('<target>virt-viewer_0.4.0.orig.tar.gz</target>')
    >>> u.tarball
    '../virt-viewer_0.4.0.orig.tar.gz'
    >>> u.uptodate
    False
    >>> u._parse('')
    Traceback (most recent call last):
    ...
    gbp.deb.uscan.UscanError: Couldn't find 'upstream-url' in uscan output

)

def _parse_uptodate(self, out):

Check if the uscan reports that we're up to date.

Parameters | out | uscan output (type: string)

Returns

`True` if package is uptodate

    >>> u = Uscan('http://example.com/')
    >>> u._parse_uptodate('<status>up to date</status>')
    True
    >>> u.tarball
    >>> u.uptodate
    True
    >>> u._parse_uptodate('')
    False
    >>> u.tarball
    >>> u.uptodate
    False

def _raise_error(self, out):

Parse the uscan output for errors and warnings and raise a `UscanError` exception based on this. If no error detail is found a generic error message is used.

Parameters | out | uscan output (type: string)

Raises

UscanError

exception raised

    >>> u = Uscan('http://example.com/')
    >>> u._raise_error("<warnings>uscan warning: "
    ... "In watchfile debian/watch, reading webpage\n"
    ... "http://a.b/ failed: 500 Cant connect "
    ... "to example.com:80 (Bad hostname)</warnings>")
    Traceback (most recent call last):
    ...
    gbp.deb.uscan.UscanError: Uscan failed: uscan warning: In watchfile debian/watch, reading webpage
    http://a.b/ failed: 500 Cant connect to example.com:80 (Bad hostname)
    >>> u._raise_error("<errors>uscan: Can't use --verbose if "
    ... "you're using --dehs!</errors>")
    Traceback (most recent call last):
    ...
    gbp.deb.uscan.UscanError: Uscan failed: uscan: Can't use --verbose if you're using --dehs!
    >>> u = u._raise_error('')
    Traceback (most recent call last):
    ...
    gbp.deb.uscan.UscanError: Uscan failed - debug by running 'uscan --verbose'

def scan(self, destdir="""..""", download_version=None):

Invoke uscan to fetch a new upstream version

Returns | `True` if a new version was downloaded