add an 'sanitize' helper script
authorAndrea Righi <andrea.righi@canonical.com>
Mon, 11 Dec 2023 13:48:32 +0000 (14:48 +0100)
committerAndrea Righi <andrea.righi@canonical.com>
Mon, 11 Dec 2023 13:59:01 +0000 (14:59 +0100)
Add a simple 'sanitize' script that allows to run the "sanitize binary"
from source without installing anything in the system.

Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
kconfig/sanitize.py [changed mode: 0755->0644]
sanitize [new file with mode: 0755]

old mode 100755 (executable)
new mode 100644 (file)
diff --git a/sanitize b/sanitize
new file mode 100755 (executable)
index 0000000..43fb55c
--- /dev/null
+++ b/sanitize
@@ -0,0 +1,21 @@
+#!/usr/bin/env python3
+# -*- mode: python -*-
+
+# This file is not installed; it's just to run annotations from inside a source
+# distribution without installing it in the system.
+
+import os
+from kconfig import sanitize
+
+
+# Update PATH to make sure that annotations can be executed directly from the
+# source directory.
+def update_path():
+    script_dir = os.path.dirname(os.path.abspath(__file__))
+    current_path = os.environ.get("PATH", "")
+    new_path = f"{script_dir}:{current_path}"
+    os.environ["PATH"] = new_path
+
+
+update_path()
+exit(sanitize.main())