36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
| from compat2and3 import find_executable
except ImportError:
find_executable = lambda name: False
# Minimal depends: probing
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
class Check(object):
"""
Now this definitely requires customization. Each plugin can carry
a list of (soft-) dependency names.
\# depends: config, appcore >= 2.0, bin:wkhtmltoimage, python < 3.5
Here only in-application modules are honored, system references
ignored. Unknown plugin names are also skipped. A real install
helper might want to auto-tick them on, etc. This example is just
meant for probing downloadable plugins.
The .valid() helper only asserts the api: string, or skips existing
|
|
|
| 36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
| from compat2and3 import find_executable
except ImportError:
find_executable = lambda name: False
# Minimal depends: probing
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
class Check():
"""
Now this definitely requires customization. Each plugin can carry
a list of (soft-) dependency names.
… # depends: config, appcore >= 2.0, bin:wkhtmltoimage, python < 3.5
Here only in-application modules are honored, system references
ignored. Unknown plugin names are also skipped. A real install
helper might want to auto-tick them on, etc. This example is just
meant for probing downloadable plugins.
The .valid() helper only asserts the api: string, or skips existing
|
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
|
# debugging
log = logging.getLogger("pluginconf.dependency")
# ignore bin:… or python:… package in depends
system_deps = False
def __init__(self, add={}, core=["st2", "uikit", "config", "action"]):
"""
Prepare list of known plugins and versions in self.have={}
Parameters
----------
add : dict
name to pmd list of existing/core/virtual plugins (can define
versions or own dependencies)
core : list
name list of virtual plugins
"""
self.have = {
"python": {"version": sys.version}
}
# inject virtual modules
for name, meta in add.items():
if isinstance(meta, bool):
meta = 1 if meta else -1
if isinstance(meta, tuple):
meta = ".".join(str(n) for n in meta)
if isinstance(meta, (int, float, str)):
meta = {"version": str(meta)}
self.have[name] = meta
|
|
|
| 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
|
# debugging
log = logging.getLogger("pluginconf.dependency")
# ignore bin:… or python:… package in depends
system_deps = False
def __init__(self, add=None, core=["st2", "uikit", "config", "action"]):
"""
Prepare list of known plugins and versions in self.have={}
Parameters
----------
add : dict
name to pmd list of existing/core/virtual plugins (can define
versions or own dependencies)
core : list
name list of virtual plugins
"""
self.have = {
"python": {"version": sys.version}
}
# inject virtual modules
for name, meta in (add or {}).items():
if isinstance(meta, bool):
meta = 1 if meta else -1
if isinstance(meta, tuple):
meta = ".".join(str(n) for n in meta)
if isinstance(meta, (int, float, str)):
meta = {"version": str(meta)}
self.have[name] = meta
|