aboutsummaryrefslogtreecommitdiffhomepage
path: root/gbp/scripts
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2011-12-18 13:41:13 +0100
committerGuido Günther <agx@sigxcpu.org>2011-12-18 13:44:26 +0100
commit686f29c108099bdd55aa95caf2ac350c60339c54 (patch)
tree8cb3f9bb3ffe7e49fc14331b50f1356b5734f1d3 /gbp/scripts
parent1f85957f1607ddba35da20c0b0fa34ce05f49e4d (diff)
scripts/pq: handle patches without filename extension
Don't fail if patches don't have a proper patch header and filename extensions (like in the heimdal package)
Diffstat (limited to 'gbp/scripts')
-rw-r--r--gbp/scripts/pq.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/gbp/scripts/pq.py b/gbp/scripts/pq.py
index 5b7f32cd..e8e9497e 100644
--- a/gbp/scripts/pq.py
+++ b/gbp/scripts/pq.py
@@ -304,12 +304,17 @@ def get_patch_subject_from_filename(patch):
'foo'
>>> get_patch_subject('debian/patches/foo.bar')
'foo.bar'
+ >>> get_patch_subject('debian/patches/foo')
+ 'foo'
"""
subject = os.path.basename(patch)
# Strip of .diff or .patch from patch name
- base, ext = subject.rsplit('.', 1)
- if ext in [ 'diff', 'patch' ]:
- subject = base
+ try:
+ base, ext = subject.rsplit('.', 1)
+ if ext in [ 'diff', 'patch' ]:
+ subject = base
+ except ValueError:
+ pass # No ext so keep subject as is
return subject
def apply_and_commit_patch(repo, patch, topic=None):