diff options
author | Michael Palimaka <kensington@gentoo.org> | 2016-12-22 06:07:45 +1100 |
---|---|---|
committer | Michael Palimaka <kensington@gentoo.org> | 2016-12-22 06:54:48 +1100 |
commit | faea11639892c8175f34b62c8315713395e75d16 (patch) | |
tree | 2794d87a61bfcf27574b23881c29dbc2073f231e /tatt | |
parent | Replace hard-coded bug update script with brand new template. (diff) | |
download | tatt-faea11639892c8175f34b62c8315713395e75d16.tar.gz tatt-faea11639892c8175f34b62c8315713395e75d16.tar.bz2 tatt-faea11639892c8175f34b62c8315713395e75d16.zip |
When using -b, fetch atoms from the new atom field or flagged attachment.
Diffstat (limited to 'tatt')
-rw-r--r-- | tatt/packageFinder.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/tatt/packageFinder.py b/tatt/packageFinder.py index f0fb467..c1d7bd0 100644 --- a/tatt/packageFinder.py +++ b/tatt/packageFinder.py @@ -1,13 +1,17 @@ -"""module for identifying package names in files and strings""" +"""module for extracting packages from a package/architecture list """ -import re from .gentooPackage import gentooPackage as gP -def findPackages (s, regexp): +def findPackages (s, arch): """ Given a string s, - and a compiled regexp regexp - return all gentooPacakges that can be identified in the string""" + and a string arch + return all gentooPackages from that string that need actioning on that arch """ - # Should it be this simple? - return [gP(ps) for ps in regexp.findall(s)] - # Yes, it is... + packages = [] + + for line in s.splitlines(): + atom, _, arches = line.partition(' ') + if not arches or arch in arches.split(' '): + packages.append(gP(atom)) + + return(packages) |