From 71f9b7024465773271cae4d42fdfd202e7abe04e Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Tue, 8 Apr 2014 13:16:10 +0300 Subject: [PATCH] setup.py: take summary from spec file Utilize a new more generic function for parsing packaging data from the spec file. Change-Id: I746fd29755435d997ed2943e9a93835c447d4813 Signed-off-by: Markus Lehtonen --- setup.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 10c192a..43e4322 100644 --- a/setup.py +++ b/setup.py @@ -22,17 +22,17 @@ from setuptools import setup -def get_version(): - """Get version from the spec file""" +def tag_from_spec(tag): + """Get value of an rpm tag from the spec file""" with open('packaging/obs-service-git-buildpackage.spec', 'r') as spec: for line in spec.readlines(): - if line.lower().startswith('version:'): + if line.lower().startswith(tag.lower() + ':'): return line.split(':', 1)[1].strip() - raise Exception('ERROR: unable to parse version from spec file') + raise Exception("ERROR: unable to parse '%s' from spec file" % tag) setup(name='obs_service_gbp', - version=get_version(), - description='OBS source service utilizing git-buildpackage', + version=tag_from_spec('Version'), + description=tag_from_spec('Summary'), author='Markus Lehtonen', author_email='markus.lehtonen@linux.intel.com', packages=['obs_service_gbp', 'obs_service_gbp_utils', 'gbp_repocache'], -- 2.7.4