forked from SamuelMarks/py-typed-settings
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
58 lines (51 loc) · 1.79 KB
/
Copy pathsetup.py
File metadata and controls
58 lines (51 loc) · 1.79 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
# -*- coding: utf-8 -*-
from ast import parse
from distutils.sysconfig import get_python_lib
from functools import partial
from operator import attrgetter, itemgetter
from os import listdir, path
from sys import version_info
from setuptools import find_packages, setup
if version_info[0] == 2:
from itertools import ifilter as filter
from itertools import imap as map
if __name__ == "__main__":
package_name = "py_typed_settings"
with open(path.join(package_name, "__init__.py")) as f:
__author__, __version__ = map(
lambda const: const.value if hasattr(const, "value") else const.s,
map(
attrgetter("value"),
map(
itemgetter(0),
map(
attrgetter("body"),
map(
parse,
filter(
lambda line: line.startswith("__version__")
or line.startswith("__author__"),
f,
),
),
),
),
),
)
to_funcs = lambda *paths: (
partial(path.join, path.dirname(__file__), package_name, *paths),
partial(path.join, get_python_lib(prefix=""), package_name, *paths),
)
_data_join, _data_install_dir = to_funcs("_data")
setup(
name=package_name,
author=__author__,
version=__version__,
install_requires=["pyyaml"],
# test_suite=package_name + ".tests",
packages=find_packages(),
package_dir={package_name: package_name},
data_files=[
(_data_install_dir(), list(map(_data_join, listdir(_data_join()))))
],
)