summaryrefslogtreecommitdiffstats
path: root/tests/data
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:54:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:58:39 +0000
commit129a1fb4dbc375be0fa926964aa1be46a0cdbbef (patch)
tree04c0088df47415b24a5be1325d3656b8c3881c04 /tests/data
parentInitial commit. (diff)
downloaddebputy-129a1fb4dbc375be0fa926964aa1be46a0cdbbef.tar.xz
debputy-129a1fb4dbc375be0fa926964aa1be46a0cdbbef.zip
Adding upstream version 0.1.21.upstream/0.1.21
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/data')
-rw-r--r--tests/data/custom-plugin.json.in16
-rw-r--r--tests/data/custom_plugin.py25
2 files changed, 41 insertions, 0 deletions
diff --git a/tests/data/custom-plugin.json.in b/tests/data/custom-plugin.json.in
new file mode 100644
index 0000000..67ca847
--- /dev/null
+++ b/tests/data/custom-plugin.json.in
@@ -0,0 +1,16 @@
+{
+ "plugin-initializer": "custom_plugin_initializer",
+ "api-compat-version": 1,
+ "packager-provided-files": [
+ {
+ "stem": "test-file-from-json",
+ "installed-path": "/usr/share/test-files/{name}.test",
+ "default-mode": "0644",
+ "allow-name-segment": true,
+ "reference-documentation": {
+ "description": "test of loading PPFs from a JSON",
+ "format-documentation-uris": ["man:ls(1)"]
+ }
+ }
+ ]
+}
diff --git a/tests/data/custom_plugin.py b/tests/data/custom_plugin.py
new file mode 100644
index 0000000..41d9779
--- /dev/null
+++ b/tests/data/custom_plugin.py
@@ -0,0 +1,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"
+ )