-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
executable file
·101 lines (86 loc) · 3.4 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
"""
HErmes setup.py file. To install, run python setup.py install. Requirese python >=3.6
"""
import sys
import re
import os
import os.path
import pathlib
import pkg_resources as pk
from setuptools import setup
def is_tool(name):
"""Check whether `name` is on PATH."""
from distutils.spawn import find_executable
return find_executable(name) is not None
# get_version and conditional adding of pytest-runner
# are taken from
# https://github.com/mark-adams/pyjwt/blob/b8cc504ee09b4f6b2ba83a3db95206b305fe136c/setup.py
def get_version(package):
"""
Return package version as listed in `__version__` in `init.py`.
"""
with open(os.path.join(package, '__init__.py'), 'rb') as init_py:
src = init_py.read().decode('utf-8')
return re.search("__version__ = ['\"]([^'\"]+)['\"]", src).group(1)
version = get_version('HErmes')
long_description = "Aggregate data from hdf or root files and conveniently apply filter criterias.\
Explore datasets with ease with a focus on interactivity and rapidity."
#parse the requirements.txt file
# FIXME: this might not be the best way
install_requires = ['sphinx', 'sphinx_rtd_theme']
with pathlib.Path('requirements.txt').open() as requirements_txt:
for line in requirements_txt.readlines():
if line.startswith('#'):
continue
try:
req = str([j for j in pk.parse_requirements(line)][0])
except Exception as e:
print (f'WARNING: {e} : Can not parse requirement {line}')
continue
install_requires.append(req)
h5ls_available = is_tool('h5ls')
if not h5ls_available:
print ("ERROR: h5ls is not installed. This will cause MASSIVE problems in case you intend to work with hdf files.")
#requirements.append("tables>=3.3.0") # problem with travis CI, removed from requirments.txt
tests_require = [
'pytest>=3.0.5',
'pytest-cov',
'pytest-runner',
]
needs_pytest = set(('pytest', 'test', 'ptr')).intersection(sys.argv)
setup_requires = ['pytest-runner'] if needs_pytest else []
#setup_requires += ["matplotlib>=1.5.0"]
setup(name='HErmes-py',
version=version,
python_requires='>=3.6.0',
description='Highly efficient, rapid multipurpose event selection',
long_description=long_description,
author='Achim Stoessl',
author_email="[email protected]",
url='https://github.com/achim1/HErmes',
#download_url="pip install HErmes",
install_requires=install_requires,
setup_requires=setup_requires,
license="GPL",
#cmdclass={'install': full_install},
platforms=["Ubuntu 18.04", "Ubuntu 20.04"],
classifiers=[
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.8",
"Topic :: Scientific/Engineering :: Physics"
],
keywords=["event selection", "physics",\
"hep", "particle physics"\
"astrophysics", "data analysis"],
tests_require=tests_require,
packages=['HErmes',\
'HErmes.visual', 'HErmes.utils',\
'HErmes.selection', 'HErmes.fitting',\
'HErmes.analysis'],
#scripts=[],
package_data={'HErmes': [ 'utils/PATTERNS.cfg']}
)