107
108
109
110
111
112
113
114
115
116
117
118
119
120
121 | if gz:
bin = gzip_decode(bin)
if decode:
return bin.decode("utf-8", errors='ignore')
else:
return str(bin)
except:
log_WARN("get_data() didn't find:", fn, "in", file_base)
# Plugin name lookup
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
# Search through ./plugins/ (and other configured plugin_base
# names or paths) and get module basenames. |
|
| 107
108
109
110
111
112
113
114
115
116
117
118
119
120
121 | if gz:
bin = gzip_decode(bin)
if decode:
return bin.decode("utf-8", errors='ignore')
else:
return str(bin)
except:
pass#log_WARN("get_data() didn't find:", fn, "in", file_base)
# Plugin name lookup
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
# Search through ./plugins/ (and other configured plugin_base
# names or paths) and get module basenames. |
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173 |
# Try via pkgutil first,
# find any plugins.* modules, or main packages
if module:
fn = module
for base in plugin_base + extra_base:
try:
src = get_data(fn+".py", decode=True, file_base=base)
if src: break
except:
continue # plugin_meta_extract() will print a notice later
# Real filename/path
elif fn and os.path.exists(fn):
src = open(fn).read(4096) |
|
| 159
160
161
162
163
164
165
166
167
168
169
170
171
172
173 |
# Try via pkgutil first,
# find any plugins.* modules, or main packages
if module:
fn = module
for base in plugin_base + extra_base:
try:
src = get_data(fn=fn+".py", decode=True, file_base=base)
if src: break
except:
continue # plugin_meta_extract() will print a notice later
# Real filename/path
elif fn and os.path.exists(fn):
src = open(fn).read(4096) |
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396 | #
class dependency(object):
# prepare list of known plugins and versions
def __init__(self):
self.have = all_plugin_meta()
# dependencies on core modules are somewhat more interesting:
self.have.update({
"streamtuner2": plugin_meta(module="st2", extra_base=["config"]),
"uikit": plugin_meta(module="uikit", extra_base=["config"]),
"config": plugin_meta(module="config", extra_base=["config"]),
"action": plugin_meta(module="action", extra_base=["config"]),
})
have = {}
# depends:
def depends(self, plugin):
if plugin.get("depends"):
d = self.deps(plugin["depends"])
if not self.cmp(d, self.have): |
<
<
<
|
|
<
>
| 377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393 | #
class dependency(object):
# prepare list of known plugins and versions
def __init__(self):
self.have = all_plugin_meta()
# dependencies on core modules are somewhat more interesting:
for name in ("st2", "uikit", "config", "action"):
self.have[name] = plugin_meta(module=name, extra_base=["config"])
self.have["streamtuner2"] = self.have["st2"]
have = {}
# depends:
def depends(self, plugin):
if plugin.get("depends"):
d = self.deps(plugin["depends"])
if not self.cmp(d, self.have): |