-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
76 lines (58 loc) · 2.77 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
import re
import sys
import setuptools
def get_version(path="src/tygs/__init__.py"):
""" Return the version of by with regex intead of importing it"""
init_content = open(path, "rt").read()
pattern = r"^__version__ = ['\"]([^'\"]*)['\"]"
return re.search(pattern, init_content, re.M).group(1)
def get_requirements(path):
setuppy_format = \
'https://github.com/{user}/{repo}/tarball/master#egg={egg}'
setuppy_pattern = \
r'github.com/(?P<user>[^/.]+)/(?P<repo>[^.]+).git#egg=(?P<egg>.+)'
dep_links = []
install_requires = []
with open(path) as f:
for line in f:
if "sys_platform" in line:
line, platform = line.split(';')
match = re.search(r'sys_platform\s*==\s*(.*)', platform)
if sys.platform != match.groups()[0].strip('\"\''):
continue
if line.startswith('-e'):
url_infos = re.search(setuppy_pattern, line).groupdict()
dep_links.append(setuppy_format.format(**url_infos))
line = '=='.join(url_infos['egg'].rsplit('-', 1))
install_requires.append(line.strip())
return install_requires, dep_links
requirements, _ = get_requirements('requirements.txt')
dev_requirements, _ = get_requirements('dev-requirements.txt')
setuptools.setup(name='tygs',
version=get_version(),
description='New generation web framework',
long_description=open('README.rst').read().strip(),
author='Sam & Gordon',
author_email='lesametlemax@gmail.com',
url='https://github.com/sametmax/tygs/',
packages=setuptools.find_packages('src'),
package_dir={'': 'src'},
install_requires=requirements,
extras_require={
'dev': dev_requirements
},
setup_requires=['pytest-runner'],
tests_require=dev_requirements,
include_package_data=True,
license='WTFPL',
zip_safe=False,
keywords='tygs async rpc pubsub http websocket',
classifiers=['Development Status :: 1 - Planning',
'Intended Audience :: Developers',
'Natural Language :: English',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3 :: Only',
'Topic :: Internet :: WWW/HTTP :: HTTP Servers',
'Topic :: Internet :: WWW/HTTP :: Site '
'Management',
'Operating System :: OS Independent'],)