Index: pluginconf.py ================================================================== --- pluginconf.py +++ pluginconf.py @@ -397,24 +397,36 @@ # for application-level modules. # class dependency(object): # prepare list of known plugins and versions - def __init__(self, core={}): - self.have = {}.update(core) - self.have = all_plugin_meta() - # dependencies on core modules are somewhat more interesting: - for name in ("st2", "uikit", "config", "action"): + def __init__(self, add={}, core=["st2", "uikit", "config", "action"]): + 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 + # read plugins/* + self.have.update(all_plugin_meta()) + # add core modules + for name in core: self.have[name] = plugin_meta(module=name, extra_base=["config"]) - self.have["streamtuner2"] = self.have["st2"] - have = {} + # 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"): - d = self.deps(plugin["depends"]) - if not self.cmp(d, self.have): + 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) @@ -430,23 +442,27 @@ elif have_ver >= newpl.get("version", "0.0"): pass else: return True - # Split trivial "pkg, mod >= 1, uikit < 4.0" list + # Split trivial "pkg | alt, mod >= 1, uikit < 4.0" string into nested list [[dep],[alt,alt],[dep]] def deps(self, dep_str): - d = [] - for dep in re.split(r"\s*[,;]+\s*", dep_str): - # skip deb:pkg-name, rpm:name, bin:name etc. - if not len(dep) or dep.find(":") >= 0: - continue - # find comparison and version num - dep += " >= 0" - m = re.search(r"([\w.-]+)\s*([>== 0: + continue + # find comparison and version num + part += " >= 0" + m = re.search(r"([\w.-]+)\s*([>=": curr > ver, "<": curr < ver, "!=": curr != ver, } - #log.VERSION_COMPARE(name, " → (", curr, op, ver, ") == ", r) r &= tbl.get(op, True) + #print "log.VERSION_COMPARE: ", name, " → (", curr, op, ver, ") == ", r return r # Add plugin defaults to conf.* store # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ Index: st2.py ================================================================== --- st2.py +++ st2.py @@ -2,21 +2,22 @@ # encoding: UTF-8 # api: python # type: application # title: streamtuner2 # description: Directory browser for internet radio, audio and video streams -# version: 2.2.0-rc3 +# version: 2.2.0-rc4 # state: stable # author: Mario Salzer # license: Public Domain # url: http://freshcode.club/projects/streamtuner2 # config: # { type: env, name: HTTP_PROXY, description: proxy for HTTP access } # { type: env, name: XDG_CONFIG_HOME, description: relocates user .config subdirectory } # category: sound # depends: pygtk | gi, threading, requests, pyquery, lxml -# id: streamtuner2 +# alias: streamtuner2, main +# id: st2 # pack: *.py, gtk3.xml.gz, bin, channels/__init__.py, bundle/*.py, CREDITS, help/index.page, # streamtuner2.desktop, README, help/streamtuner2.1=/usr/share/man/man1/, # NEWS=/usr/share/doc/streamtuner2/, icon.png=/usr/share/pixmaps/streamtuner2.png # architecture: all #