forked from hendrix/hendrix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
133 lines (107 loc) · 3.2 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
import errno
import os
import sys
from setuptools import setup, find_packages
from setuptools.command.install import install
from hendrix import __version__
def file_name(rel_path):
dir_path = os.path.dirname(__file__)
return os.path.join(dir_path, rel_path)
def read(rel_path):
with open(file_name(rel_path)) as f:
return f.read()
def mkdir_p(path):
"recreate mkdir -p functionality"
try:
os.makedirs(path)
except OSError as exc: # Python >2.5
if exc.errno == errno.EEXIST and os.path.isdir(path):
pass
else:
raise
share_path = os.path.join(
os.path.dirname(sys.executable),
'share/hendrix'
)
mkdir_p(share_path)
INSTALL_REQUIRES = [
'twisted',
'cryptography>=2.3',
'watchdog',
'jinja2',
'pychalk',
'service-identity',
'six',
'autobahn'
]
EXTRAS = {
'tests': [
'pytest',
'pytest-cov',
'pytest-mock',
'pytest-twisted',
'django',
'flask',
'urllib3',
'requests',
'coverage'
'codecov',
'gunicorn'
]
}
class VerifyVersionCommand(install):
"""Custom command to verify that the git tag matches our version"""
description = 'verify that the git tag matches our version'
def run(self):
tag = os.getenv('CIRCLE_TAG')
if tag.startswith('v'):
tag = tag[1:]
version = __version__
if version.startswith('v'):
version = version[1:]
if tag != version:
info = "Git tag: {0} does not match the version of this app: {1}".format(
os.getenv('CIRCLE_TAG'), __version__
)
sys.exit(info)
setup(
name="hendrix",
version=__version__,
description="Pure python web server, based on Twisted, providing the One Obvious Way to do async and offbeat network traffic with django and other WSGI apps.",
author="hendrix",
author_email="[email protected]",
packages=find_packages(),
url="https://github.com/hendrix/hendrix",
download_url=(
"https://github.com/hendrix/hendrix/tarball/"
"v" + __version__
),
long_description=read('README.md'),
long_description_content_type='text/markdown',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Framework :: Django',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: POSIX',
'Programming Language :: Python',
'Topic :: Internet',
'Topic :: Utilities',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: WSGI',
'Topic :: Internet :: WWW/HTTP :: WSGI :: Server',
],
keywords=["django", "twisted", "async", "logging", "wsgi"],
scripts=[
'hendrix/utils/scripts/hx',
'hendrix/utils/scripts/hxw',
'hendrix/utils/scripts/install-hendrix-service'
],
data_files=[
(share_path, ['hendrix/utils/templates/init.d.j2', ]),
],
install_requires=INSTALL_REQUIRES,
extras_require=EXTRAS,
cmdclass={'verify': VerifyVersionCommand}
)