diff options
| author | Scott Bahling <sbahling@suse.com> | 2020-01-31 13:08:50 +0100 |
|---|---|---|
| committer | Scott Bahling <sbahling@suse.com> | 2020-01-31 13:08:50 +0100 |
| commit | 82d23ff08d7010663b7e404a95a08897523ee8c5 (patch) | |
| tree | 11a951415d78de92bfd0387ffefdfe3dc5c338a3 /obsapi/core.py | |
| parent | c0f4c40a9261b62ee041d8c9c0261a8662bf6e8f (diff) | |
| download | obsapi-82d23ff08d7010663b7e404a95a08897523ee8c5.tar.gz obsapi-82d23ff08d7010663b7e404a95a08897523ee8c5.tar.xz obsapi-82d23ff08d7010663b7e404a95a08897523ee8c5.zip | |
use re for finding vendor macro
Diffstat (limited to 'obsapi/core.py')
| -rw-r--r-- | obsapi/core.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/obsapi/core.py b/obsapi/core.py index cf2ec37..57903e5 100644 --- a/obsapi/core.py +++ b/obsapi/core.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- # +import re from io import BytesIO from lxml import etree from collections import namedtuple @@ -287,14 +288,13 @@ class ObsApi(object): else: repos = self.get_project_repos(prj) + vendor_re = re.compile(r'.*vendor (.+?)\n') vendor = None for repo in repos: - for line in self.get_build_config(prj, repo).splitlines(): - if line.strip().startswith('%vendor '): - vendor = line.split(' ', 1)[1] - - # We take the first occurance - if vendor is not None: + prj_config = self.get_build_config(prj, repo) + matches = vendor_re.findall(prj_config) + if matches: + vendor = matches[-1] break return vendor |
