-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup.py
executable file
·72 lines (64 loc) · 2.3 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
#!/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('''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="zeitgitterd",
version=describe_or_extract_version('zeitgitter/version.py'),
author="Marcel Waldvogel",
author_email="marcel.waldvogel@trifence.ch",
description="Zeitgitter timestamping server",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://gitlab.com/zeitgitter/zeitgitterd",
license='AGPLv3',
packages=setuptools.find_packages(),
install_requires=['pygit2', 'python-gnupg', 'configargparse', 'requests',
'setuptools', 'git-timestamp'],
package_data={'zeitgitter': ['sample.conf', 'web/*']},
python_requires='>=3.7',
entry_points={
'console_scripts': [
'zeitgitterd=zeitgitter.server:run',
],
},
classifiers=[
"Development Status :: 4 - Beta",
"Environment :: No Input/Output (Daemon)",
"Intended Audience :: Information Technology",
"Programming Language :: Python",
"License :: OSI Approved :: GNU Affero General Public License v3",
"Operating System :: OS Independent",
"Natural Language :: English",
"Topic :: Software Development :: Version Control :: Git",
"Topic :: Security",
],
)