-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
50 lines (44 loc) · 1.22 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
44
45
46
47
48
49
50
import os
import subprocess
from distutils.core import setup
try:
if os.path.exists(".git"):
s = subprocess.Popen(["git", "rev-parse", "HEAD"],
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
out = s.communicate()[0]
GIT_REVISION = out.strip()
else:
GIT_REVISION = "unknown"
except WindowsError:
GIT_REVISION = "unknown"
FULL_VERSION = '0.1.0-dev'
if "dev" in FULL_VERSION:
RELEASED = False
VERSION = FULL_VERSION + '-' + GIT_REVISION[:7]
else:
RELEASED = True
VERSION = FULL_VERSION
def generate_version_py(filename):
cnt = """\
# This file was autogenerated
version = '%s'
git_revision = '%s'
"""
cnt = cnt % (VERSION, GIT_REVISION)
f = open(filename, "w")
try:
f.write(cnt)
finally:
f.close()
if __name__ == '__main__':
generate_version_py("sahgutils/__dev_version.py")
setup(
name='SAHGutils',
version=VERSION,
author='Scott Sinclair',
author_email='[email protected]',
packages=['sahgutils', 'sahgutils.io'],
license='LICENSE.txt',
description='Useful tools for data analysis and plots.',
long_description=open('README.txt').read(),
)