-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
94 lines (76 loc) · 2.7 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
91
92
93
94
#!/usr/bin/env python -u
import os
import re
import sys
import time
from setuptools import setup, find_packages
_INCLUDE = re.compile(r"\.(txt|gif|jpg|png|css|html|js|xml|po|mo)$")
_HERE = os.path.abspath(os.path.dirname(__file__))
def get_package_data() -> 'Dict[str, List[str]]':
package_data = {}
for pkg in os.listdir(_root_directory):
pkg_path = os.path.join(_root_directory, pkg)
if os.path.isdir(pkg_path):
package_data[pkg] = create_paths(pkg_path)
return package_data
def create_paths(root_dir: str) -> 'List[str]':
paths = []
is_package = os.path.exists(os.path.join(root_dir, '__init__.py'))
children = os.listdir(root_dir)
for child in children:
childpath = os.path.join(root_dir, child)
if os.path.isfile(childpath) and not is_package and \
_INCLUDE.search(child):
paths.append(child)
if os.path.isdir(childpath):
paths += [os.path.join(child, path) for path in create_paths(os.path.join(root_dir, child))]
return paths
def read_version() -> str:
fn = os.path.join(_HERE, "authserver", "authserver", "__init__.py")
with open(fn, "rt", encoding="utf-8") as vf:
lines = vf.readlines()
for l in lines:
m = re.match("version = \"(.+?)\"", l)
if m:
return m.group(1)
raise Exception("Can't read base version from %s" % fn)
version = read_version()
if version.endswith(".dev"):
_version = "%s%s" % (version, int(time.time()))
else:
_version = version
try:
long_description = open(os.path.join(_HERE, 'README.rst')).read()
except IOError:
long_description = None
_packages = find_packages(where='authserver', exclude=["*.tests", "*.tests.*", "tests.*", "tests"])
with open(os.path.join(_HERE, "requirements.txt"), "rt") as reqfile:
reqs = reqfile.readlines()
# on windows remove python-daemon
if sys.platform == "win32":
for r in reqs:
if r.startswith("python-daemon"):
reqs.remove(r)
break
_root_directory = "authserver"
setup(
name="net.maurus.authserver",
version=_version,
packages=_packages,
package_dir={
'': _root_directory,
},
entry_points={
"console_scripts": [
"dkimsigner = maildaemons.dkimsigner.server:main",
"mailforwarder = maildaemons.forwarder.server:main",
"checkpassword = authclient.checkpassword:main",
],
},
install_requires=reqs,
package_data=get_package_data(),
author="Jonas Maurus",
url="https://github.com/jdelic/authserver/",
description="A Python 3 Django-based OAuth2/Docker Auth/JWT SSO server with additional mail routing.",
long_description=long_description,
)