-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
70 lines (64 loc) · 2.48 KB
/
setup.py
File metadata and controls
70 lines (64 loc) · 2.48 KB
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
from os import path, name
from subprocess import call
from traceback import print_exc
from setuptools import setup, find_packages
from setuptools.command.install import install
here = path.abspath(path.dirname(__file__))
class SystemD(install):
def run(self):
super().run()
try:
if name == 'posix':
print('Registering service with systemd...')
with open(path.join(here, 'minipyp', 'minipyp.service')) as stream:
executable = path.join(self.install_scripts, 'minipyp')
service = stream.read().format(executable)
with open(path.join('lib', 'systemd', 'system', 'minipyp.service'), 'w') as target:
target.write(service)
call(['systemd', 'enable', 'minipyp'])
except:
print('Failed to register service. Printing traceback and continuing install...')
print_exc()
with open(path.join(here, 'README.rst')) as file:
readme = file.read()
with open(path.join(here, 'HISTORY.rst')) as file:
readme += '\n\n' + file.read()
there = {}
with open(path.join(here, 'minipyp', 'minipyp.py')) as file:
exec(file.read(), there)
if '__version__' not in there.keys():
raise Exception('Failed to fetch version from source')
setup(
name='minipyp',
version=there['__version__'],
description='A more traditional web server',
long_description=readme,
url='https://minipyp.readthedocs.io/en/latest/',
author='Ryan Garber',
author_email='ryanmichaelgarber@gmail.com',
classifiers=[
'Development Status :: 3 - Alpha',
'License :: OSI Approved :: MIT License',
'Topic :: Internet :: WWW/HTTP :: HTTP Servers',
'Natural Language :: English',
'Intended Audience :: System Administrators',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7'
],
keywords='http https web cgi fast-cgi fpm ssl tls socket proxy reverse',
packages=find_packages(exclude=['docs', 'tests']),
download_url='https://github.com/RyanGarber/minipyp/archive/' + there['__version__'] + '.tar.gz',
install_requires=['requests', 'PyYAML'],
tests_require=['pytest'],
python_requires='>=3',
entry_points={
'console_scripts': [
'minipyp=minipyp:main'
]
},
cmdclass={
'install': SystemD
}
)