summaryrefslogtreecommitdiff
path: root/obsapi/core.py
diff options
context:
space:
mode:
authorScott Bahling <sbahling@suse.de>2015-04-19 12:48:45 +0200
committerScott Bahling <sbahling@suse.de>2015-04-19 12:48:45 +0200
commit8fd95bc298868b14f0a5986589caa986cb52bcaf (patch)
treedf5c0a1c82e450193597d857120f25de4eb71ee6 /obsapi/core.py
parentc9f684add9ab52175fe060991c1595e0f631945b (diff)
downloadobsapi-8fd95bc298868b14f0a5986589caa986cb52bcaf.tar.gz
obsapi-8fd95bc298868b14f0a5986589caa986cb52bcaf.tar.xz
obsapi-8fd95bc298868b14f0a5986589caa986cb52bcaf.zip
Fixup get_vendor method
Handle projects without repositories.
Diffstat (limited to 'obsapi/core.py')
-rw-r--r--obsapi/core.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/obsapi/core.py b/obsapi/core.py
index 9445f3f..c9b2b40 100644
--- a/obsapi/core.py
+++ b/obsapi/core.py
@@ -268,10 +268,19 @@ class ObsApi(object):
return self.get_xml(api)
def get_vendor(self, prj, repo=None):
- repo = repo or self.get_project_repos(prj)[0]
+ ''' Attempt to get the value of the %vendor macro if exists
+ Search build configs from all repos. Take first occurance.
+ '''
+ project_repos = self.get_project_repos(prj)
+ repos = [repo] or project_repos
vendor = None
- for line in self.get_build_config(prj, repo).splitlines():
- if line.strip().startswith('%vendor '):
- vendor = line.split(' ', 1)[1]
+ 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:
+ break
return vendor