[ARVADOS] created: d2f8375b79f4c37f2ab167f5d230d60fc514b1fb

git at public.curoverse.com git at public.curoverse.com
Mon Sep 22 16:43:40 EDT 2014


        at  d2f8375b79f4c37f2ab167f5d230d60fc514b1fb (commit)


commit d2f8375b79f4c37f2ab167f5d230d60fc514b1fb
Author: Brett Smith <brett at curoverse.com>
Date:   Mon Sep 22 16:45:19 2014 -0400

    3848: Python packages build with git tag by default.
    
    This moves the build logic that we currently encode in Jenkins into
    our setup.py, and makes it easier for developers to have versions in
    sync with real users.

diff --git a/sdk/python/setup.py b/sdk/python/setup.py
index e0afe89..ede62d1 100644
--- a/sdk/python/setup.py
+++ b/sdk/python/setup.py
@@ -1,10 +1,26 @@
 #!/usr/bin/env python
 
 import os
+import subprocess
 
 from setuptools import setup, find_packages
 
-README = os.path.join(os.path.dirname(__file__), 'README.rst')
+SETUP_DIR = os.path.dirname(__file__)
+README = os.path.join(SETUP_DIR, 'README.rst')
+
+cmd_opts = {'egg_info': {}}
+try:
+    git_tag = subprocess.check_output(
+        ['git', 'log', '--format=format:%ci %h', '-n1', SETUP_DIR])
+except (OSError, subprocess.CalledProcessError):
+    pass
+else:
+    git_tags = git_tag.split()
+    del git_tags[-2]   # Remove timezone
+    for ii in [0, 1]:  # Remove non-digits from other datetime fields
+        git_tags[ii] = ''.join(c for c in git_tags[ii] if c.isdigit())
+    cmd_opts['egg_info']['tag_build'] = '.{}{}.{}'.format(*git_tags)
+
 
 setup(name='arvados-python-client',
       version='0.1',
@@ -33,4 +49,6 @@ setup(name='arvados-python-client',
         ],
       test_suite='tests',
       tests_require=['mock>=1.0', 'PyYAML'],
-      zip_safe=False)
+      zip_safe=False,
+      options=cmd_opts,
+      )
diff --git a/services/fuse/setup.py b/services/fuse/setup.py
index 02450cb..026b208 100644
--- a/services/fuse/setup.py
+++ b/services/fuse/setup.py
@@ -1,10 +1,26 @@
 #!/usr/bin/env python
 
 import os
+import subprocess
 
 from setuptools import setup, find_packages
 
-README = os.path.join(os.path.dirname(__file__), 'README.rst')
+SETUP_DIR = os.path.dirname(__file__)
+README = os.path.join(SETUP_DIR, 'README.rst')
+
+cmd_opts = {'egg_info': {}}
+try:
+    git_tag = subprocess.check_output(
+        ['git', 'log', '--format=format:%ci %h', '-n1', SETUP_DIR])
+except (OSError, subprocess.CalledProcessError):
+    pass
+else:
+    git_tags = git_tag.split()
+    del git_tags[-2]   # Remove timezone
+    for ii in [0, 1]:  # Remove non-digits from other datetime fields
+        git_tags[ii] = ''.join(c for c in git_tags[ii] if c.isdigit())
+    cmd_opts['egg_info']['tag_build'] = '.{}{}.{}'.format(*git_tags)
+
 
 setup(name='arvados_fuse',
       version='0.1',
@@ -26,4 +42,6 @@ setup(name='arvados_fuse',
         ],
       test_suite='tests',
       tests_require=['PyYAML'],
-      zip_safe=False)
+      zip_safe=False,
+      options=cmd_opts,
+      )

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list