-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
executable file
·112 lines (99 loc) · 3.54 KB
/
setup.py
File metadata and controls
executable file
·112 lines (99 loc) · 3.54 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
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
import os
import sys
import shutil
from pathlib import Path
from sysconfig import get_paths
from setuptools import setup, Extension
def set_environment_variable(key, value):
"""Set an environment variable."""
os.environ[key] = value
print(f"Environment variable {key} set to {value}.")
def check_environment_variable(key):
"""Check if an environment variable exists and return its value."""
global err
value = os.environ.get(key)
if value:
print(f"Environment variable {key} is set to {value}.")
else:
print(f"\033[31mEnvironment variable {key} is not set.\033[0m")
err += 1
def check_required_executables(executables):
global err
missing_executables = []
for executable in executables:
whi = shutil.which(executable)
if whi != None:
print(f"Executable '{executable}' is found.")
elif whi == None:
print(f"\033[31mExecutable '{executable}' is missing.\033[0m")
missing_executables.append(executable)
err += 1
if missing_executables:
print("\n\033[31mMissing executable:")
for executable in missing_executables:
print(f" - {executable}")
print("\033[31mPlease check the above executables.\033[0m\n")
current_path = os.getcwd()
set_env_var = {'IPSF_PY_HOME' : current_path}
chk_env_var = ['SCHRODINGER', 'AMBERHOME']
chk_executables = ['pmemd', 'sander', 'antechamber', 'parmchk2', 'pmemd.MPI', 'pmemd.cuda']
include_root = get_paths()['include']
err = 0
sr1 = Extension(name='pdbclean',
sources=['lrip_py/csrc/pdbclean.c'],
language='c',
libraries=['m'],
library_dirs=[include_root],
)
sr2 = Extension(name='ie_ave',
sources=['lrip_py/csrc/ie_ave.c'],
language='c',
libraries=['m'],
library_dirs=[include_root],
)
try:
setup(
name='lrip-py',
version='1.0.1',
description='LRIP-SF: An automated workflow for machine learning-molecular mechanics scoring function. Just for internal use, please do not share.',
author='Taoyu Niu',
author_email='tan77@pitt.edu, niutaoyu@gmail.com',
#license='MIT',
packages=['lrip_py',
'lrip_py.ml',
'lrip_py.prep',
'lrip_py.utils'],
package_dir={'lrip_py' : 'lrip_py',
'lrip_py.ml' : 'lrip_py/ml',
'lrip_py.prep' : 'lrip_py/prep',
'lrip_py.utils' : 'lrip_py/utils',},
include_package_data=True,
python_requires='>=3.12',
install_requires=[ 'concurrently',
'pandas',
'numpy',
'scikit-learn==1.7.0',
'scipy',
'pickledb',
'datetime',
'psutil==5.9.0',
],
ext_modules=[sr1, sr2],
entry_points={
'console_scripts': [
'pdbclean = pdbclean:pdbclean',
'ie_ave = ie_ave:ie_ave',
]}
)
except Exception as e:
print(f"\033[31mError during setup: {e}\033[0m")
err += 1
sys.exit(1)
for sev in set_env_var:
set_environment_variable(sev, set_env_var[sev])
for cev in chk_env_var:
check_environment_variable(cev)
check_required_executables(chk_executables)
if err > 0:
print("\033[31mSetup failed. Please check above info.\033[0m")
sys.exit(1)