-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
90 lines (68 loc) · 2.14 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import os
import sys
import subprocess
DOCLINES = (__doc__ or '').split("\n")
if sys.version_info[:2] < (3, 6):
raise RuntimeError("Python version >= 3.6 required.")
MAJOR = 1
MINOR = 0
MICRO = 0
IS_RELEASED = False
VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
def git_version():
try:
rev = subprocess.check_output(['git', 'rev-parse', 'HEAD'])
return rev.strip().decode('ascii')
except (subprocess.SubprocessError, OSError):
return "Unknown"
def get_version_info():
full_version = VERSION
if os.path.exists('.git'):
git_revision = git_version()
else:
git_revision = "Unknown"
if not IS_RELEASED:
full_version += '.dev0+' + git_revision[:7]
return full_version, git_revision
def write_version_py(filename='txtcr/version.py'):
full_version, git_revision = get_version_info()
content = "# Version file generated by setup.py \n" \
"\n" \
f"short_version = '{VERSION}' \n" \
f"version = '{VERSION}' \n" \
f"full_version = '{full_version}' \n" \
f"git_revision = '{git_revision}' \n" \
f"release = {str(IS_RELEASED)} \n" \
"\n" \
"\n" \
f"if not release: \n" \
f" version = full_version \n"
with open(filename, 'w') as f:
f.write(content)
def setup_package():
from setuptools import setup
write_version_py()
setup(
name='TXTCR',
version=get_version_info()[0],
description='',
url='https://github.com/4surix/txtcr',
project_urls={
'Source Code': 'https://github.com/4surix/txtcr',
'Bug Tracker': 'https://github.com/4surix/txtcr/issues',
},
author='4surix',
author_email='[email protected]',
maintainer='Fabien "BioTheWolff" Z.',
maintainer_email='[email protected]',
packages=[
'txtcr',
'txtcr.core',
'txtcr.util',
'txtcr.requests'
],
python_requires='>=3.6',
zip_safe=False
)
if __name__ == '__main__':
setup_package()