summaryrefslogtreecommitdiffstats
path: root/bin/setup_paths.py
diff options
context:
space:
mode:
authorEmilio Pozuelo Monfort <pochu@debian.org>2020-08-13 11:47:12 +0200
committerEmilio Pozuelo Monfort <pochu@debian.org>2020-08-13 11:49:08 +0200
commitf815d2033d464c3838f07188b8aa0ce773b6e57b (patch)
treee11f5594ad35aa4b6d13c0624a667ee3d6ccd88e /bin/setup_paths.py
parent71313afc95839aafa97534d37995156f19eb2ce4 (diff)
De-duplicate setup_path
All the scripts in bin/ can share the definition. Also setup_paths.py calls setup_path so one just has to import that module before importing those from lib/python/. Additionally this helps some scripts work better under Python 3, as one variant of setup_paths that we had called string.rfind, which is not present there.
Diffstat (limited to 'bin/setup_paths.py')
-rw-r--r--bin/setup_paths.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/bin/setup_paths.py b/bin/setup_paths.py
new file mode 100644
index 0000000000..d2f8194662
--- /dev/null
+++ b/bin/setup_paths.py
@@ -0,0 +1,11 @@
+# inserts lib/python/ into sys.path
+
+import os
+import sys
+
+def setup_path():
+ dirname = os.path.dirname
+ base = dirname(dirname(os.path.realpath(__file__)))
+ sys.path.insert(0, os.path.join(base, "lib", "python"))
+
+setup_path()

© 2014-2024 Faster IT GmbH | imprint | privacy policy