-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
41 lines (34 loc) · 1.31 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
# -*- coding: utf-8 -*-
from ast import parse
from distutils.sysconfig import get_python_lib
from functools import partial
from os import path, listdir
from platform import python_version_tuple
from setuptools import setup, find_packages
if python_version_tuple()[0] == '3':
imap = map
ifilter = filter
else:
from itertools import imap, ifilter
if __name__ == '__main__':
package_name = 'ml_params_flax'
with open(path.join(package_name, '__init__.py')) as f:
__author__, __version__ = imap(
lambda buf: next(imap(lambda e: e.value.s, parse(buf).body)),
ifilter(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(imap(_data_join, listdir(_data_join()))))
]
)