-
Notifications
You must be signed in to change notification settings - Fork 8
/
dependencies.py
95 lines (83 loc) · 3.01 KB
/
dependencies.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
# --------------------------------------------------------------------------
# Blendyn -- file dependencies.py
# Copyright (C) 2015 -- 2021 Andrea Zanoni -- [email protected]
# --------------------------------------------------------------------------
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This file is part of Blendyn, add-on script for Blender.
#
# Blendyn is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Blendyn is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Blendyn. If not, see <http://www.gnu.org/licenses/>.
#
# ***** END GPL LICENCE BLOCK *****
# --------------------------------------------------------------------------
from collections import namedtuple
global deps
class Dependency:
# Generic dependency.
# :module: name of the module
# :package: name of the python package (if None, package = module)
# :name: name to be given to module during import (if None, name = module)
# :installed: boolean flag indicating if the dependency is found in the system
module = None
package = None
name = None
is_installed = False
def __init__(self, module, package, name):
self.module = module
self.package = package
self.name = name
def installed(self, flag = None):
if not flag:
# getter for is_installed Flag
return self.is_installed
else:
# setter for is_installed Flag
self.is_installed = flag
# -----------------------------------------------------------
# end of Dependency class
# Numpy (FIXME: check if really needed)
numpy_deps = (\
Dependency("numpy", None, None),\
)
# NetCDF
netcdf_deps = (\
Dependency("netCDF4", None, None),\
)
# Plotting with Pygal/Cairosvg
plotting_pygal_deps = (\
Dependency("pygal", None, None),\
Dependency("cairosvg", None, None)\
)
# Control of MBDyn simulation from Blender
psutil_deps = (\
Dependency("psutil", None, None),\
)
# Plotting with Matplotlib
plotting_matplotlib_deps = (\
Dependency("matplotlib", None, None),\
)
# Plotting with Bokeh and html2image
plotting_bokeh_deps = (
Dependency("bokeh", None, None),
Dependency("html2image", None, None)
)
# Dictionary of dependencies
deps = {
"Numpy": numpy_deps,
"Support for NetCDF output": netcdf_deps,
"Plotting - Pygal": plotting_pygal_deps,
"Plotting - Matplotlib": plotting_matplotlib_deps,
"Plotting - Bokeh": plotting_bokeh_deps,
"Running MBDyn from Blender UI -- WARNING: Needs Python headers! ---": psutil_deps
}