[ARVADOS] created: f8067dd18b72705f3317e85745e87cffc9e25313
git at public.curoverse.com
git at public.curoverse.com
Sun Feb 8 22:25:15 EST 2015
at f8067dd18b72705f3317e85745e87cffc9e25313 (commit)
commit f8067dd18b72705f3317e85745e87cffc9e25313
Author: Tom Clegg <tom at curoverse.com>
Date: Sun Feb 8 18:53:49 2015 -0500
5175: Do not add +sha1 tag unless --sha1-tag flag given.
diff --git a/sdk/python/gittaggers.py b/sdk/python/gittaggers.py
new file mode 100644
index 0000000..ea78981
--- /dev/null
+++ b/sdk/python/gittaggers.py
@@ -0,0 +1,40 @@
+from setuptools.command.egg_info import egg_info
+import subprocess
+import time
+
+class GitTagger(egg_info):
+ """Tag the build with git commit info.
+
+ Exact choice and format is determined by subclass's tags_to_add
+ method.
+
+ If a build tag has already been set (e.g., "egg_info -b", building
+ from source package), leave it alone.
+ """
+ def git_commit_info(self):
+ gitinfo = subprocess.check_output(
+ ['git', 'log', '--first-parent', '--max-count=1',
+ '--format=format:%ct %h', '.']).split()
+ assert len(gitinfo) == 2
+ return {
+ 'commit_utc': time.strftime(
+ '%Y%m%d%H%M%S', time.gmtime(int(gitinfo[0]))),
+ 'commit_sha1': gitinfo[1],
+ }
+
+ def tags(self):
+ if self.tag_build is None:
+ self.tag_build = self.tags_to_add()
+ return egg_info.tags(self)
+
+
+class TagBuildWithCommitDateAndSha1(GitTagger):
+ """Tag the build with the sha1 and date of the last git commit."""
+ def tags_to_add(self):
+ return '.{commit_utc}+{commit_sha1}'.format(**self.git_commit_info())
+
+
+class TagBuildWithCommitDate(GitTagger):
+ """Tag the build with the date of the last git commit."""
+ def tags_to_add(self):
+ return '.{commit_utc}'.format(**self.git_commit_info())
diff --git a/sdk/python/setup.py b/sdk/python/setup.py
index 754d89b..ed27fac 100644
--- a/sdk/python/setup.py
+++ b/sdk/python/setup.py
@@ -1,32 +1,24 @@
#!/usr/bin/env python
import os
-import subprocess
-import time
+import sys
from setuptools import setup, find_packages
from setuptools.command.egg_info import egg_info
-SETUP_DIR = os.path.dirname(__file__)
+SETUP_DIR = os.path.dirname(__file__) or '.'
README = os.path.join(SETUP_DIR, 'README.rst')
-class TagBuildWithCommit(egg_info):
- """Tag the build with the sha1 and date of the last git commit.
-
- If a build tag has already been set (e.g., "egg_info -b", building
- from source package), leave it alone.
- """
- def tags(self):
- if self.tag_build is None:
- git_tags = subprocess.check_output(
- ['git', 'log', '--first-parent', '--max-count=1',
- '--format=format:%ct %h', SETUP_DIR]).split()
- assert len(git_tags) == 2
- git_tags[0] = time.strftime(
- '%Y%m%d%H%M%S', time.gmtime(int(git_tags[0])))
- self.tag_build = '.{}+{}'.format(*git_tags)
- return egg_info.tags(self)
-
+if '--sha1-tag' in sys.argv:
+ import gittaggers
+ tagger = gittaggers.TagBuildWithCommitDateAndSha1
+ sys.argv.remove('--sha1-tag')
+else:
+ try:
+ import gittaggers
+ tagger = gittaggers.TagBuildWithCommitDate
+ except ImportError:
+ tagger = egg_info
setup(name='arvados-python-client',
version='0.1',
@@ -59,5 +51,5 @@ setup(name='arvados-python-client',
test_suite='tests',
tests_require=['mock>=1.0', 'PyYAML'],
zip_safe=False,
- cmdclass={'egg_info': TagBuildWithCommit},
+ cmdclass={'egg_info': tagger},
)
diff --git a/services/fuse/gittaggers.py b/services/fuse/gittaggers.py
new file mode 120000
index 0000000..a9ad861
--- /dev/null
+++ b/services/fuse/gittaggers.py
@@ -0,0 +1 @@
+../../sdk/python/gittaggers.py
\ No newline at end of file
diff --git a/services/fuse/setup.py b/services/fuse/setup.py
index 7c84531..97f4c1d 100644
--- a/services/fuse/setup.py
+++ b/services/fuse/setup.py
@@ -1,32 +1,24 @@
#!/usr/bin/env python
import os
-import subprocess
-import time
+import sys
from setuptools import setup, find_packages
from setuptools.command.egg_info import egg_info
-SETUP_DIR = os.path.dirname(__file__)
+SETUP_DIR = os.path.dirname(__file__) or '.'
README = os.path.join(SETUP_DIR, 'README.rst')
-class TagBuildWithCommit(egg_info):
- """Tag the build with the sha1 and date of the last git commit.
-
- If a build tag has already been set (e.g., "egg_info -b", building
- from source package), leave it alone.
- """
- def tags(self):
- if self.tag_build is None:
- git_tags = subprocess.check_output(
- ['git', 'log', '--first-parent', '--max-count=1',
- '--format=format:%ct %h', SETUP_DIR]).split()
- assert len(git_tags) == 2
- git_tags[0] = time.strftime(
- '%Y%m%d%H%M%S', time.gmtime(int(git_tags[0])))
- self.tag_build = '.{}+{}'.format(*git_tags)
- return egg_info.tags(self)
-
+if '--sha1-tag' in sys.argv:
+ import gittaggers
+ tagger = gittaggers.TagBuildWithCommitDateAndSha1
+ sys.argv.remove('--sha1-tag')
+else:
+ try:
+ import gittaggers
+ tagger = gittaggers.TagBuildWithCommitDate
+ except ImportError:
+ tagger = egg_info
setup(name='arvados_fuse',
version='0.1',
@@ -37,7 +29,7 @@ setup(name='arvados_fuse',
url="https://arvados.org",
download_url="https://github.com/curoverse/arvados.git",
license='GNU Affero General Public License, version 3.0',
- packages=['arvados_fuse'],
+ packages=find_packages(),
scripts=[
'bin/arv-mount'
],
@@ -49,5 +41,5 @@ setup(name='arvados_fuse',
test_suite='tests',
tests_require=['PyYAML'],
zip_safe=False,
- cmdclass={'egg_info': TagBuildWithCommit},
+ cmdclass={'egg_info': tagger},
)
diff --git a/services/nodemanager/gittaggers.py b/services/nodemanager/gittaggers.py
new file mode 120000
index 0000000..a9ad861
--- /dev/null
+++ b/services/nodemanager/gittaggers.py
@@ -0,0 +1 @@
+../../sdk/python/gittaggers.py
\ No newline at end of file
diff --git a/services/nodemanager/setup.py b/services/nodemanager/setup.py
index 5fc4294..c28505b 100644
--- a/services/nodemanager/setup.py
+++ b/services/nodemanager/setup.py
@@ -1,36 +1,29 @@
#!/usr/bin/env python
import os
-import subprocess
-import time
+import sys
from setuptools import setup, find_packages
from setuptools.command.egg_info import egg_info
SETUP_DIR = os.path.dirname(__file__) or "."
+README = os.path.join(SETUP_DIR, 'README.rst')
-class TagBuildWithCommit(egg_info):
- """Tag the build with the sha1 and date of the last git commit.
-
- If a build tag has already been set (e.g., "egg_info -b", building
- from source package), leave it alone.
- """
- def tags(self):
- if self.tag_build is None:
- git_tags = subprocess.check_output(
- ['git', 'log', '--first-parent', '--max-count=1',
- '--format=format:%ct %h', SETUP_DIR]).split()
- assert len(git_tags) == 2
- git_tags[0] = time.strftime(
- '%Y%m%d%H%M%S', time.gmtime(int(git_tags[0])))
- self.tag_build = '.{}+{}'.format(*git_tags)
- return egg_info.tags(self)
-
+if '--sha1-tag' in sys.argv:
+ import gittaggers
+ tagger = gittaggers.TagBuildWithCommitDateAndSha1
+ sys.argv.remove('--sha1-tag')
+else:
+ try:
+ import gittaggers
+ tagger = gittaggers.TagBuildWithCommitDate
+ except ImportError:
+ tagger = egg_info
setup(name='arvados-node-manager',
version='0.1',
description='Arvados compute node manager',
- long_description=open(os.path.join(SETUP_DIR, 'README.rst')).read(),
+ long_description=open(README).read(),
author='Arvados',
author_email='info at arvados.org',
url="https://arvados.org",
@@ -46,5 +39,5 @@ setup(name='arvados-node-manager',
test_suite='tests',
tests_require=['mock>=1.0'],
zip_safe=False,
- cmdclass={'egg_info': TagBuildWithCommit},
+ cmdclass={'egg_info': tagger},
)
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list