4400: Fix whitespace. Fix tagging in nodemanager, too.
[arvados.git] / services / nodemanager / setup.py
1 #!/usr/bin/env python
2
3 import os
4 import subprocess
5 import time
6
7 from setuptools import setup, find_packages
8 from setuptools.command.egg_info import egg_info
9
10 SETUP_DIR = os.path.dirname(__file__) or "."
11
12 class TagBuildWithCommit(egg_info):
13     """Tag the build with the sha1 and date of the last git commit.
14
15     If a build tag has already been set (e.g., "egg_info -b", building
16     from source package), leave it alone.
17     """
18     def tags(self):
19         if self.tag_build is None:
20             git_tags = subprocess.check_output(
21                 ['git', 'log', '--first-parent', '--max-count=1',
22                  '--format=format:%ct %h', SETUP_DIR]).split()
23             assert len(git_tags) == 2
24             git_tags[0] = time.strftime(
25                 '%Y%m%d%H%M%S', time.gmtime(int(git_tags[0])))
26             self.tag_build = '.{}.{}'.format(*git_tags)
27         return egg_info.tags(self)
28
29
30 setup(name='arvados-node-manager',
31       version='0.1',
32       description='Arvados compute node manager',
33       long_description=open(os.path.join(SETUP_DIR, 'README.rst')).read(),
34       author='Arvados',
35       author_email='info@arvados.org',
36       url="https://arvados.org",
37       license='GNU Affero General Public License, version 3.0',
38       packages=find_packages(),
39       install_requires=[
40         'apache-libcloud',
41         'arvados-python-client',
42         'pykka',
43         'python-daemon',
44         ],
45       scripts=['bin/arvados-node-manager'],
46       test_suite='tests',
47       tests_require=['mock>=1.0'],
48       zip_safe=False,
49       cmdclass={'egg_info': TagBuildWithCommit},
50       )