aboutsummaryrefslogtreecommitdiffhomepage
path: root/gbp/deb.py
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2011-04-09 22:38:40 +0200
committerGuido Günther <agx@sigxcpu.org>2011-04-09 22:38:40 +0200
commit943686c8c059f6aa90cb03a86862ddd0253f46de (patch)
tree5b5d393b1144a30b625771460265cb291b20b1d6 /gbp/deb.py
parent61513e6869a0c6d9036da3fe255bf2e2d3f5796a (diff)
parentaa72b4f43d64e9669752441d13d12add743907df (diff)
Merge branch 'master' into experimental
Diffstat (limited to 'gbp/deb.py')
-rw-r--r--gbp/deb.py40
1 files changed, 30 insertions, 10 deletions
diff --git a/gbp/deb.py b/gbp/deb.py
index ff361d66..9f81c6a5 100644
--- a/gbp/deb.py
+++ b/gbp/deb.py
@@ -244,8 +244,14 @@ def orig_file(cp, compression):
def is_native(cp):
- "Is this a debian native package"
- return [ True, False ]['-' in cp['Version']]
+ """
+ Is this a debian native package
+ >>> is_native(dict(Version="1"))
+ True
+ >>> is_native(dict(Version="1-1"))
+ False
+ """
+ return not '-' in cp['Version']
def is_valid_packagename(name):
"Is this a valid Debian package name?"
@@ -256,8 +262,19 @@ def is_valid_upstreamversion(version):
return upstreamversion_re.match(version)
def get_compression(orig_file):
- "Given an orig file return the compression used"
- ext = orig_file.rsplit('.',1)[1]
+ """
+ Given an orig file return the compression used
+ >>> get_compression("abc.tar.gz")
+ 'gzip'
+ >>> get_compression("abc.tar.bz2")
+ 'bzip2'
+ >>> get_compression("abc.tar.foo")
+ >>> get_compression("abc")
+ """
+ try:
+ ext = orig_file.rsplit('.',1)[1]
+ except IndexError:
+ return None
for (c, o) in compressor_opts.iteritems():
if o[1] == ext:
return c
@@ -265,12 +282,15 @@ def get_compression(orig_file):
def has_epoch(cp):
- """does the topmost version number contain an epoch"""
- try:
- if cp['Epoch']:
- return True
- except KeyError:
- return False
+ """
+ Does the topmost version number in the changelog contain an epoch
+ >>> has_epoch(dict(Epoch="1"))
+ True
+ >>> has_epoch(dict())
+ False
+ """
+ return cp.has_key("Epoch")
+
def has_orig(cp, compression, dir):
"Check if orig.tar.gz exists in dir"