1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
# encoding: UTF-8
# api: python
# type: handler
# category: io
# title: Plugin configuration
# description: Read meta data, pyz/package contents, module locating
# version: 0.6.5
# priority: core
# docs: http://fossil.include-once.org/streamtuner2/wiki/plugin+meta+data
# config: -
#
# Provides plugin lookup and meta data extraction utility functions.
# It's used to abstract module+option management in applications.
# For consolidating internal use and external/tool accessibility.
|
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
# encoding: UTF-8
# api: python
# type: handler
# category: io
# title: Plugin configuration
# description: Read meta data, pyz/package contents, module locating
# version: 0.6.6
# priority: core
# docs: http://fossil.include-once.org/streamtuner2/wiki/plugin+meta+data
# config: -
#
# Provides plugin lookup and meta data extraction utility functions.
# It's used to abstract module+option management in applications.
# For consolidating internal use and external/tool accessibility.
|
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
|
for name in core:
self.have[name] = plugin_meta(module=name, extra_base=["config"])
# aliases
for name, meta in self.have.items():
if meta.get("alias"):
for alias in re.split("\s*[,;]\s*", meta["alias"]):
self.have[alias] = self.have[name]
# depends:
def depends(self, plugin):
if plugin.get("depends"):
dep_cmp = self.deps(plugin["depends"])
if not (True in [self.cmp(alt_cmp, self.have) for alt_cmp in dep_cmp]):
return False
return True
# basic list pre-filtering (skip __init__, filter by api:,
# exclude installed & same-version plugins)
def valid(self, newpl):
id = newpl.get("$name", "__invalid")
have_ver = self.have.get(id, {}).get("version", "0")
if id.find("__") == 0:
|
>
>
>
>
|
>
|
|
|
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
|
for name in core:
self.have[name] = plugin_meta(module=name, extra_base=["config"])
# aliases
for name, meta in self.have.items():
if meta.get("alias"):
for alias in re.split("\s*[,;]\s*", meta["alias"]):
self.have[alias] = self.have[name]
#dbg
#for name,meta in sorted(self.have.items()):
# print "HAVE ", name, " == ", meta.get("version")
# depends:
def depends(self, plugin):
r = True
if plugin.get("depends"):
dep_cmp = self.deps(plugin["depends"])
for alt_cmp in dep_cmp:
if not True in [self.cmp([d], self.have) for d in alt_cmp]:
r = False
return r
# basic list pre-filtering (skip __init__, filter by api:,
# exclude installed & same-version plugins)
def valid(self, newpl):
id = newpl.get("$name", "__invalid")
have_ver = self.have.get(id, {}).get("version", "0")
if id.find("__") == 0:
|