setup.py: take summary from spec file
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Tue, 8 Apr 2014 10:16:10 +0000 (13:16 +0300)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Tue, 8 Apr 2014 10:16:10 +0000 (13:16 +0300)
Utilize a new more generic function for parsing packaging data from the
spec file.

Change-Id: I746fd29755435d997ed2943e9a93835c447d4813
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
setup.py

index 10c192a0140de891c8f0fdf6ecd48cf6db185170..43e432226af3bcb55ef0f2b2e459f062de166792 100644 (file)
--- a/setup.py
+++ b/setup.py
 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'],