-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·43 lines (36 loc) · 1.33 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import subprocess
from setuptools import setup, find_packages, Command
from stratus import __version__
class WriteVersion(Command):
description = "Write version from git"
user_options = [('version=', 'v',
"Write version into package if no version specify use git")]
def initialize_options(self):
self.version = None
def finalize_options(self):
if self.version is None:
commit_b = subprocess.check_output(
'git rev-parse --verify --short HEAD', shell=True)
commit = commit_b.decode('utf-8').strip()
current_version = __version__.split('-')[0]
self.version = '{}-{}'.format(current_version, commit)
def run(self):
with open('stratus/__init__.py' , 'w') as version_file:
version_file.write('__version__ = \'{}\''.format(self.version))
setup(
name='stratus',
version=__version__,
description='An hypervisor manager without agent',
license='GPLv3',
url='https://github.com/Zempashi/stratus',
packages=find_packages(),
package_data={'stratus.managers.aknansible': ['playbooks/*.yml']},
install_requires=['django',
'djangorestframework>=3',
'channels'],
cmdclass={
'writeversion': WriteVersion
},
)