forked from Matgenix/turbomoleio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·138 lines (112 loc) · 3.61 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/usr/bin/env python
"""Setup script for turbomoleio."""
import os
import sys
from glob import glob
from setuptools import find_packages
# changing Python version requirements.
if sys.version[0:3] < "3.8":
sys.stderr.write(
"ERROR: turbomoleio requires Python Version 3.6 or above. "
"You are using version {}. Exiting.".format(sys.version)
)
sys.exit(1)
def file_doesnt_end_with(test, endings):
"""Check file endings.
A little utility we'll need below, since glob() does NOT allow
you to do exclusion on multiple endings!
Return true if test is a file and its name does NOT end with any
of the strings listed in endings.
"""
if not os.path.isfile(test):
return False
for e in endings:
if test.endswith(e):
return False
return True
# ---------------------------------------------------------------------------
# Basic project information
# ---------------------------------------------------------------------------
def find_package_data():
"""Find package_data."""
package_data = {"turbomoleio": ["input/templates/*.yaml"]}
return package_data
def find_scripts():
"""Find scripts."""
scripts = []
#
# All python files in turbomoleio/scripts
# scripts for more specific technical tasks should be put in devscripts
# these are not standard installed
pyfiles = glob(os.path.join("turbomoleio", "scripts", "*.py"))
scripts.extend(pyfiles)
return scripts
def cleanup():
"""Clean up the junk left around by the build process."""
if "develop" not in sys.argv:
import shutil
try:
shutil.rmtree("turbomoleio.egg-info")
except: # noqa: E722
try:
os.unlink("turbomoleio.egg-info")
except: # noqa: E722
pass
# List of external packages we rely on.
# Note setup install will download them from Pypi if they are not available.
install_requires = [
"numpy",
"matplotlib",
"pandas",
"pymatgen>=2019.2.28",
"monty>=2.0.4",
"pexpect>=4.7",
"cerberus",
]
# ---------------------------------------------------------------------------
# Find all the packages, package data, and data_files
# ---------------------------------------------------------------------------
# Get the set of packages to be included.
my_packages = find_packages(exclude=())
my_scripts = find_scripts()
my_package_data = find_package_data()
about = {}
with open(
os.path.join(os.path.dirname(__file__), "turbomoleio", "__version__.py"), "r"
) as f:
exec(f.read(), about) # nosec
# Create a dict with the basic information
# This dict is eventually passed to setup after additional keys are added.
setup_args = dict(
name="turbomoleio",
version=about["__version__"],
description=about["__description__"],
long_description=about["__long_description__"],
author="Michiel van Setten, David Waroquiers, Guido Petretto, Jan Kloppenburg",
author_email="mjvansetten@gmail.com, "
"david.waroquiers@matgenix.com, "
"guido.petretto@matgenix.com, "
"jan.kloppenburg@uclouvain.be",
# url=url,
# download_url=download_url,
license="license",
platforms="platforms",
keywords="keywords",
install_requires=install_requires,
packages=my_packages,
package_data=my_package_data,
scripts=my_scripts,
extras_require={
"testing": [
"pytest >= 3.8.0",
"pytest-cov >= 2.6.0",
],
"docs": [
"sphinx >= 1.8.1",
],
},
)
if __name__ == "__main__":
from setuptools import setup
setup(**setup_args)
cleanup()