File: custom_plugin.py

package info (click to toggle)
debputy 0.1.78
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 4,616 kB
  • sloc: python: 66,232; perl: 155; sh: 102; makefile: 39
file content (25 lines) | stat: -rw-r--r-- 695 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from debputy.plugin.api import (
    DebputyPluginInitializer,
    VirtualPath,
    BinaryCtrlAccessor,
    PackageProcessingContext,
)


def _udeb_metadata_detector(
    _path: VirtualPath,
    ctrl: BinaryCtrlAccessor,
    _context: PackageProcessingContext,
) -> None:
    ctrl.substvars["Test:Udeb-Metadata-Detector"] = "was-run"


def custom_plugin_initializer(api: DebputyPluginInitializer) -> None:
    api.packager_provided_file(
        "my-file",
        "/no-where/this/is/a/test/plugin/{name}.conf",
        post_formatting_rewrite=lambda x: x.replace("+", "_"),
    )
    api.metadata_or_maintscript_detector(
        "udeb-only", _udeb_metadata_detector, package_type="udeb"
    )