amprolla

devuan's apt repo merger
git clone git://parazyd.org/amprolla.git
Log | Files | Refs | README | LICENSE

commit 6dd25d4218ae3536eaffd1eee3dd05f8836ee49d
parent 1d85a8d1cdd5794fdd6362254d0953c85ca2cc2a
Author: parazyd <parazyd@dyne.org>
Date:   Thu,  8 Jun 2017 00:48:43 +0200

don't use regular expressions in parse_packages()

Diffstat:
Mlib/parse.py | 14+++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/parse.py b/lib/parse.py @@ -4,7 +4,6 @@ Parsing functions/helpers """ -import re import time @@ -100,13 +99,14 @@ def parse_packages(pkgtext): """ _map = {} - pkgs = pkgtext.split("\n\n") + pkgs = pkgtext.split('\n\n') for pkg in pkgs: - m = re.match('Package: .+', pkg) - if m: - line = pkg[m.start():m.end()] - key = line.split(': ')[1] - _map[key] = parse_package(pkg) + single = pkg.split('\n') + for line in single: + if line.startswith('Package: '): + key = line.split(': ')[1] + _map[key] = parse_package(pkg) + break return _map