-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
56 lines (47 loc) · 1.57 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
import os
import re
from itertools import chain
from setuptools import (
find_packages,
setup,
)
REQUIREMENTS_DIR = os.path.join(os.path.dirname(__file__), 'requirements')
def get_version(package_path):
"""Extract and version number from given package's '__init__.py'.
"""
init_path = os.path.join(package_path, '__init__.py')
match = re.search(r"__version__ = '([^']+)'", open(init_path).read(), re.M)
return match.group(1)
def get_install_requires_list(
requirements_file,
requirements_dir=REQUIREMENTS_DIR,
):
"""Create a list of packages from the given requirements file.
"""
requirements = list()
with open(requirements_file) as f:
for line in f.readlines():
if line.startswith('-r'):
rpath = line.split(' ')[-1].strip()
if not rpath.startswith(requirements_dir):
rpath = os.path.join(requirements_dir, rpath)
requirements = chain(
requirements,
get_install_requires_list(rpath),
)
else:
requirements.append(line)
return list(set(requirements))
setup(
name='jobsbrowser_pipeline',
version=get_version('jobsbrowser'),
packages=find_packages(include=('jobsbrowser*',)),
include_package_data=True,
classifiers=[
'Intended Audience :: Developers',
'Programming Language :: Python :: 3',
'Topic :: Software Development :: Libraries',
],
install_requires=get_install_requires_list('requirements.txt'),
zip_safe=False,
)