class documentation

class Uscan(object):

View In Hierarchy

Undocumented

Method __init__ Undocumented
Method scan Invoke uscan to fetch a new upstream version
Class Variable cmd Undocumented
Property tarball Undocumented
Property uptodate Undocumented
Method _parse Parse the uscan output 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.
Instance Variable _dir Undocumented
Instance Variable _tarball Undocumented
Instance Variable _uptodate Undocumented
def __init__(self, dir='.'):

Undocumented

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

Invoke uscan to fetch a new upstream version

Returns
True if a new version was downloaded
cmd: str =

Undocumented

@property
tarball =

Undocumented

@property
uptodate =

Undocumented

def _parse(self, out):

Parse the uscan output and update the object's properties

Parameters
out:

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 source in uscan output
uscan output
def _parse_uptodate(self, out):

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

Parameters
out:stringuscan output
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:stringuscan output
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'
_dir =

Undocumented

_tarball =

Undocumented

_uptodate: bool =

Undocumented