From 6b3e2882414f694fa41d42c81858220f7fe28246 Mon Sep 17 00:00:00 2001
From: MJB <mjb@it-innovation.soton.ac.uk>
Date: Tue, 10 Apr 2018 16:08:56 +0100
Subject: [PATCH] package versioning for clmctests

---
 .gitignore  |  1 +
 MANIFEST.in |  2 +-
 setup.py    | 23 +++++++++++++++++------
 3 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/.gitignore b/.gitignore
index 03f004a..c39d337 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,4 +4,5 @@
 *__init__.pyc
 *egg-info*
 *git-commit-ref*
+*_version.py*
 ubuntu-xenial-16.04-cloudimg-console.log
diff --git a/MANIFEST.in b/MANIFEST.in
index e35073b..839a767 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,2 +1,2 @@
 include MANIFEST.in
-recursive-include clmctest *.yml *.sh *.json *.conf
\ No newline at end of file
+recursive-include clmctest _version.py *.yml *.sh *.json *.conf
\ No newline at end of file
diff --git a/setup.py b/setup.py
index f015c18..d24242f 100644
--- a/setup.py
+++ b/setup.py
@@ -22,23 +22,34 @@
 """
 
 import os
+import os.path
+import subprocess
 from setuptools import setup, find_packages
 
 def read(fname):
     return open(os.path.join(os.path.dirname(__file__), fname)).read()
 
+def get_version(fname):
+    if os.path.isfile(fname):
+      git_revision = read(fname)
+    else:
+      git_revision = "SNAPSHOT"
+
+    return git_revision
+
 setup(
     name = "clmctest",
-    version = "SNAPSHOT",
+    version = get_version("clmctest/_version.py"),
     author = "Michael Boniface",
     author_email = "mjb@it-innovation.soton.ac.uk",
-    description = "FLAME CLMC Testing Module",
-    license = "license",
-    keywords = "FLAME CLMC test",
+    description = "FLAME CLMC Test Module",
+    license = "https://gitlab.it-innovation.soton.ac.uk/FLAME/flame-clmc/blob/integration/LICENSE",
+    keywords = "FLAME CLMC tests",
+    url='https://gitlab.it-innovation.soton.ac.uk/FLAME/flame-clmc',
     packages=find_packages(exclude=["services"]),
     include_package_data=True,
-    package_data={'': ['git-commit-ref', '*.yml', '*.sh', '*.json', '*.conf']},        
-    long_description="long description",
+    package_data={'': ['_version.py', '*.yml', '*.sh', '*.json', '*.conf']},        
+    long_description="FLAME CLMC tests",
     classifiers=[
         "Development Status :: Alpha",
         "Topic :: FLAME Tests",
-- 
GitLab