Overview
Context
Changes
Modified pluginconf/__init__.py
from [f4eabf5fc1]
to [4be8e0326c] .
12
13
14
15
16
17
18
19
20
21
22
23
24
25
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
+
# license: PD
# priority: core
# api-docs: https://fossil.include-once.org/pluginspec/doc/trunk/html/index.html
# docs: https://fossil.include-once.org/pluginspec/
# url: http://fossil.include-once.org/streamtuner2/wiki/plugin+meta+data
# config: -
# format: off
# permissive: 0.75
# pylint: disable=invalid-name
# console-scripts: flit-pluginconf=pluginconf.flit:main, pluginconf.flit=pluginconf.flit:main
#
# 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.
#
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
+
-
+
except ImportError:
import zlib
def gzip_decode(bytestr):
""" haphazard workaround """
return zlib.decompress(bytestr, 16 + zlib.MAX_WBITS)
import zipfile
import argparse
import logging
__all__ = [
"plugin_meta", "get_data", "module_list", "add_plugin_defaults",
"PluginMeta", "all_plugin_meta",
]
# Injectables
# ‾‾‾‾‾‾‾‾‾‾‾
""" injectable callback function for logging """
log_ERR = lambda *x: None
log = logging.getLogger("pluginc onf")
"""
File lookup relation for get_data(), should name a top-level package.
(Equivalent PluginBase(package=…))
"""
module_base = "config"
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
-
+
data = pkgutil.get_data(file_base or module_base, filename)
if gzip:
data = gzip_decode(data)
if decode:
return data.decode("utf-8", errors='ignore')
return str(data)
except:
# log_ERR("get_data() didn't find:", fn, "in", file_base)
log.error ("get_data() didn't find:", fn, "in", file_base)
pass
# Plugin name lookup
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
def module_list(extra_paths=None):
"""
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
-
+
}
# Extract coherent comment block
src = src.replace("\r", "")
if not literal:
src = rx.comment.search(src)
if not src:
log_ERR("Couldn't read source meta information:", filename)
log.error ("Couldn't read source meta information:", filename)
return meta
src = src.group(0)
src = rx.hash.sub("", src).strip()
# Split comment block
if src.find("\n\n") > 0:
src, meta["doc"] = src.split("\n\n", 1)
Modified pluginconf/depends.py
from [9f3c7d2302]
to [f7f101f5bf] .
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
+
# encoding: utf-8
# api: pluginconf
##type: class
# category: config
# title: Dependency verification
# description: Check depends: lines
# depends: pluginconf >= 0.7
# version: 0.5
# state: beta
# license: PD
# priority: optional
# permissive: 0.8
#
# This is a rather basic depends: checker, mostly for local and
# installable modules. It's largely built around streamtuner2
# requirements, and should be customized.
#
# Check().depends()/.valid()
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
Modified pluginconf/flit.py
from [fd547f8d0f]
to [555cf6a6b4] .
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
+
# encoding: utf-8
# api: pep517
# title: flit backend
# description: wraps flit_core.buildapi
# version: 0.3
# depends: python:flit (>=3.0, <4.0)
# license: BSD-3-Clause
# priority: extra
# permissive: 0.1
# pylint: disable=unused-import, wrong-import-position, wrong-import-order
#
# As alternative to pluginconf.setup, this module is using flit as
# pep517 build backend. But adding automagic field lookup of course.
#
# Injecting attributes between ini reading and parameter collection
# turned out easier than expanding on flit_core.buildapi functions.
Modified pluginconf/gui.py
from [70ac617c4f]
to [309455414c] .
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
+
# encoding: UTF-8
# api: python
##type: gui
# category: io
# title: Config GUI
# description: Display plugins + options in setup window
# version: 0.8
# depends: python:pysimplegui (>= 4.0)
# priority: optional
# config: -
# permissive: 0.5
# pylint: disable=line-too-long
#
# Creates a PySimpleGUI options list. Scans a given list of *.py files
# for meta data, then populates a config{} dict and (optionally) a state
# map for plugins themselves.
#
# jsoncfg = {}
Modified pluginconf/setup.py
from [87ccea3a82]
to [2c993b00fe] .
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
+
# encoding: utf-8
# api: setuptools
##type: functions
# title: setup() wrapper
# description: utilizes PMD to populate some package fields
# version: 0.5
# license: PD
# permissive: 0.3
# pylint: disable=line-too-long
#
# Utilizes plugin meta data to cut down setup.py incantations
# to basically just:
#
# from pluginconf.setup import setup
# setup(