diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2013-08-26 16:47:57 +0300 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2014-07-24 19:59:07 +0200 |
commit | e374ee5a2381ba30056c1fa33bdb515d99ec704e (patch) | |
tree | ad631a5884c4de1ec9593dd5d51e4f9581616204 | |
parent | d76a1a55abecf66b37594fa0e7984273ef5059e7 (diff) | |
download | git-buildpackage-e374ee5a2381ba30056c1fa33bdb515d99ec704e.tar.gz git-buildpackage-e374ee5a2381ba30056c1fa33bdb515d99ec704e.tar.bz2 git-buildpackage-e374ee5a2381ba30056c1fa33bdb515d99ec704e.zip |
UpstreamSource.guess_version: don't check for directories
Directories are not recognized anyway, if guess_version() is called for
non-existent sources. And, parse_archive_filename() works fine for
directory names, too.
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
-rw-r--r-- | gbp/pkg/__init__.py | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/gbp/pkg/__init__.py b/gbp/pkg/__init__.py index 18ca8125..1fd17418 100644 --- a/gbp/pkg/__init__.py +++ b/gbp/pkg/__init__.py @@ -328,8 +328,10 @@ class UpstreamSource(object): Guess the package name and version from the filename of an upstream archive. - @param extra_regex: extra regular expression to check - @type extra_regex: raw C{string} + @param extra_regex: additional regex to apply, needs a 'package' and a + 'version' group + @return: (package name, version) or None. + @rtype: tuple >>> UpstreamSource('foo-bar_0.2.orig.tar.gz').guess_version() ('foo-bar', '0.2') @@ -356,17 +358,9 @@ class UpstreamSource(object): ('foo-bar', '0.2') >>> UpstreamSource('foo-bar-0.2.tlz').guess_version() ('foo-bar', '0.2') - - @param extra_regex: additional regex to apply, needs a 'package' and a - 'version' group - @return: (package name, version) or None. - @rtype: tuple """ version_chars = r'[a-zA-Z\d\.\~\-\:\+]' - if self.is_dir(): - basename = os.path.basename(self.path) - else: - basename = parse_archive_filename(os.path.basename(self.path))[0] + basename = parse_archive_filename(os.path.basename(self.path))[0] version_filters = map ( lambda x: x % version_chars, ( # Debian upstream tarball: package_'<version>.orig.tar.gz' |