aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Deutschmann <whissi@gentoo.org>2021-07-06 00:23:02 +0200
committerThomas Deutschmann <whissi@gentoo.org>2021-07-06 01:40:51 +0200
commit8a7e6909326b5b70076bdedb38513d93cb0d3117 (patch)
tree1054e3971f409b5612c8d8011468f05e69153963
parentgen_moddeps.sh: modules_dep_list(): Use global KEXT variable (diff)
downloadgenkernel-8a7e6909.tar.gz
genkernel-8a7e6909.tar.bz2
genkernel-8a7e6909.zip
gen_funcs.sh: expand_file(): Outsource embedded Python call
This will allow us to set proper shebang for dev-lang/python-exec[-native-symlinks] support. Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
-rwxr-xr-xgen_funcs.sh2
-rwxr-xr-xpath_expander.py18
2 files changed, 19 insertions, 1 deletions
diff --git a/gen_funcs.sh b/gen_funcs.sh
index ab7a7cea..72572299 100755
--- a/gen_funcs.sh
+++ b/gen_funcs.sh
@@ -1952,7 +1952,7 @@ expand_file() {
local file="${1}"
local expanded_file=
- expanded_file=$(python -c "import os; print(os.path.expanduser('${file}'))" 2>/dev/null)
+ expanded_file=$("${GK_SHARE}/path_expander.py" "${file}" 2>/dev/null)
if [ -z "${expanded_file}" ]
then
# if Python failed for some reason, just reset
diff --git a/path_expander.py b/path_expander.py
new file mode 100755
index 00000000..82accad8
--- /dev/null
+++ b/path_expander.py
@@ -0,0 +1,18 @@
+#!/usr/bin/env python3
+
+import os
+import sys
+
+def main(argv):
+ if len(argv) != 1:
+ print(
+ "%s expects exactly one argument but %s were given!"
+ % (os.path.basename(__file__), len(argv)),
+ file=sys.stderr
+ )
+ sys.exit(1)
+
+ print(os.path.expanduser(argv[0]))
+
+if __name__ == "__main__":
+ main(sys.argv[1:])