Check-in [499156b19b]
Overview
| Comment: | Update to pluginconf 0.7.0 - more independent fallback functions, fix `id` tuple (again?!) |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
499156b19bed09e349b058582e1d6c9d |
| User & Date: | mario on 2020-10-30 19:33:39 |
| Other Links: | manifest | tags |
Context
|
2020-10-30
| ||
| 19:34 | peertube+youtube detection check-in: 7205e8f9b4 user: mario tags: trunk | |
| 19:33 | Update to pluginconf 0.7.0 - more independent fallback functions, fix `id` tuple (again?!) check-in: 499156b19b user: mario tags: trunk | |
|
2020-05-21
| ||
| 12:36 | Fix some links, add forgotten reddit help page. check-in: 3c42414ef6 user: mario tags: trunk | |
Changes
Modified pluginconf.py from [df594147c1] to [9101ebb380].
1 2 | # encoding: UTF-8 # api: python | | | > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # encoding: UTF-8 # api: python # type: extract # category: io # title: Plugin configuration # description: Read meta data, pyz/package contents, module locating # version: 0.7.0 # priority: core # docs: https://fossil.include-once.org/pluginspec/ # url: 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. # # The key:value format is language-agnostic. It's basically YAML in |
| ︙ | ︙ | |||
78 79 80 81 82 83 84 | import sys import os import re import pkgutil import inspect | > > > > | > > > > > > | | | > > | 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 106 107 108 109 |
import sys
import os
import re
import pkgutil
import inspect
try:
from distutils.spawn import find_executable
except:
try:
from compat2and3 import find_executable
except:
def find_executable(str):
pass
try:
from gzip import decompress as gzip_decode # Py3 only
except:
try:
from compat2and3 import gzip_decode # st2 stub
except:
def gzip_decode(bytes):
import zlib
return zlib.decompress(bytes, 16 + zlib.MAX_WBITS) # not fully compatible
import zipfile
import argparse
__all__ = [
"get_data", "module_list", "plugin_meta",
"dependency", "add_plugin_defaults"
]
|
| ︙ | ︙ | |||
222 223 224 225 226 227 228 |
# fields from comment. Turns everything into an dict, with
# some stub fields if absent.
#
def plugin_meta_extract(src="", fn=None, literal=False):
# Defaults
meta = {
| | | 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
# fields from comment. Turns everything into an dict, with
# some stub fields if absent.
#
def plugin_meta_extract(src="", fn=None, literal=False):
# Defaults
meta = {
"id": os.path.splitext(os.path.basename(fn or ""))[0],
"fn": fn,
"api": "python",
"type": "module",
"category": None,
"priority": None,
"version": "0",
"title": fn,
|
| ︙ | ︙ | |||
280 281 282 283 284 285 286 287 288 289 290 291 292 293 |
"type": None,
"name": None,
"description": "",
"value": None
}
for field in rx.options.findall(entry):
opt[field[0]] = (field[1] or field[2] or field[3] or "").strip()
config.append(opt)
return config
# Comment extraction regexps
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
# Pretty crude comment splitting approach. But works
| > | 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
"type": None,
"name": None,
"description": "",
"value": None
}
for field in rx.options.findall(entry):
opt[field[0]] = (field[1] or field[2] or field[3] or "").strip()
#@todo map type:
config.append(opt)
return config
# Comment extraction regexps
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
# Pretty crude comment splitting approach. But works
|
| ︙ | ︙ |