-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
55 lines (39 loc) · 1.26 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
from setuptools import find_packages, setup
try:
from pip._internal.req import parse_requirements
except ImportError:
from pip.req import parse_requirements
def get_requirements(filename):
try:
from pip._internal.download import PipSession
session = PipSession()
except ImportError:
from pip.download import PipSession
session = PipSession()
except Exception:
session = None
reqs = parse_requirements(filename, session=session)
return [str(r.req) for r in reqs]
def get_meta():
mod_locals = {}
file_name = "flask_assetrev/__about__.py"
with open(file_name) as fp:
mod = compile(fp.read(), file_name, "exec")
exec(mod, mod_locals, mod_locals)
return dict(
(k, v) for k, v in mod_locals.items() if k in mod_locals["__all__"]
)
meta = get_meta()
setup_args = dict(
name="Flask-AssetRev",
version=meta["version"],
maintainer=meta["maintainer"],
maintainer_email=meta["maintainer_email"],
description=meta["description"],
url=meta["url"],
packages=find_packages(),
install_requires=get_requirements("requirements.txt"),
tests_require=get_requirements("requirements_dev.txt"),
)
if __name__ == "__main__":
setup(**setup_args)