-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup.py
executable file
·74 lines (66 loc) · 2.27 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
#!/usr/bin/python3
import os
import re
import subprocess
import setuptools
def extract_version(filename):
with open(filename, 'r') as fh:
for line in fh:
match = re.match(
r'''VERSION\s*=\s*["']([-_.0-9a-z]+)(\+?)["']''', line)
if match:
if match[2] == '':
return match[1]
else:
return match[1] + '.post'
exit("Cannot extract version number from %s" % filename)
def describe_or_extract_version(filename):
if 'FORCE_VERSION' in os.environ:
return os.environ['FORCE_VERSION']
ret = subprocess.run(['git', 'describe'], capture_output=True, text=True)
if ret.returncode != 0:
return extract_version(filename)
else:
match = re.match('^v?([0-9]+.[0-9]+.[0-9]+)(-([0-9]+))?', ret.stdout)
if match:
if match[3] is None:
return match[1]
else:
return match[1] + '.post' + match[3]
else:
return extract_version(filename)
with open('README.md', 'r') as fh:
long_description = fh.read()
setuptools.setup(
name="git-timestamp",
version=describe_or_extract_version('git_timestamp/timestamp.py'),
author="Marcel Waldvogel",
author_email="marcel.waldvogel@trifence.ch",
description="GIT Timestamping client for Zeitgitter",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://zeitgitter.net",
license='MIT',
packages=setuptools.find_packages(),
install_requires=[
'pygit2', 'python-gnupg', 'requests', 'setuptools', 'configargparse', 'deltat~=1.1'
],
python_requires='>=3.4',
entry_points={
'console_scripts': [
'git-timestamp=git_timestamp.timestamp:main',
],
},
classifiers=[
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Information Technology",
"Programming Language :: Python",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Natural Language :: English",
"Topic :: Software Development :: Version Control :: Git",
"Topic :: Security",
"Topic :: Utilities",
],
)