-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
70 lines (58 loc) · 2.29 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
from setuptools import setup
from setuptools.command.install import install
import os
import sys
import atexit
if __name__ == '__main__':
package_name = 'dgdynamic'
excludes = [
'__pycache__',
'StochKit'
]
extras = [
'default_config.ini',
'spim.ocaml',
'stochkit.tar.gz'
]
def find_package_dirs(package_dir_path, excludes):
return [path for path, dirs, files in os.walk(package_dir_path)
if not any(exclude_name in path for exclude_name in excludes)]
def get_requirements():
with open('requirements.txt', mode="r") as file:
return list(map(str.strip, file))
package_dirs = find_package_dirs(package_name, excludes)
internal_python_paths = {
".".join(p_name.split('/')): p_name
for p_name in package_dirs
}
class CustomInstall(install):
def run(self):
def _post_install():
def find_module_path():
for p in sys.path:
if os.path.isdir(p) and package_name in os.listdir(p):
return os.path.join(p, package_name)
install_path = find_module_path()
stochkit2_plugin_path = os.path.join(install_path, "plugins/stochastic/stochkit2/")
stochkit2_tar_path = os.path.join(stochkit2_plugin_path, "stochkit.tar.gz")
stochkit2_installer_path = os.path.join(stochkit2_plugin_path, "StochKit")
os.system("tar xvzf " + stochkit2_tar_path + " -C " + stochkit2_plugin_path)
os.system("cd " + stochkit2_installer_path + " && ./install.sh")
atexit.register(_post_install)
install.run(self)
setup(
cmdclass={'install': CustomInstall},
name=package_name,
version='1.0.0',
description='Dynamic simulation library for the MØD graph transformation framework',
url='https://bitbucket.org/Ezben/dgdynamic',
author='Anders Busch',
author_email='[email protected]',
license='MIT',
package_dir=internal_python_paths,
include_package_data=True,
package_data={'': extras},
packages=list(internal_python_paths.keys()),
install_requires=get_requirements(),
zip_safe=False
)