aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbdulwasiu Apalowo <abdulwasiuapalowo@gmail.com>2022-05-25 12:06:35 +0100
committerAbdulwasiu Apalowo <abdulwasiuapalowo@gmail.com>2022-06-01 17:34:33 +0100
commit2e4af1763e95de0a2be556a153c55890d4b9efcd (patch)
tree71c108167a6c6cb1b95f1398662f6f16ff0ff525
parent01287172bda8b6b53e22e56e0537ade75824ea49 (diff)
downloadlibvirt-ci-2e4af1763e95de0a2be556a153c55890d4b9efcd.zip
libvirt-ci-2e4af1763e95de0a2be556a153c55890d4b9efcd.tar.gz
libvirt-ci-2e4af1763e95de0a2be556a153c55890d4b9efcd.tar.bz2
lcitool: Tweak `bin/lcitool` to ensure execution works from git root
This is to prepare for the removal of the ./lcitool shell wrapper script. The ./lcitool script allows execution of lcitool without prior package installation by `pip install -e .` or `python setup.py develop`. It does this by adding lcitool/ to PYTHONPATH. This patch provides the same functionality by modifying `bin/lcitool` which will in turn allow us to drop the wrapper script. Signed-off-by: Abdulwasiu Apalowo <abdulwasiuapalowo@gmail.com>
-rwxr-xr-xguests/lcitool/bin/lcitool10
1 files changed, 10 insertions, 0 deletions
diff --git a/guests/lcitool/bin/lcitool b/guests/lcitool/bin/lcitool
index c637c1c..14d7669 100755
--- a/guests/lcitool/bin/lcitool
+++ b/guests/lcitool/bin/lcitool
@@ -8,6 +8,16 @@
import logging
import sys
+from pathlib import Path
+
+
+# This hack is to add lcitool/ to PYTHONPATH. It allows execution of
+# lcitool without prior package installation using pip.
+root = Path(__file__).parent.parent
+lib = Path(root, "lcitool")
+
+if lib.exists():
+ sys.path.insert(0, root.as_posix())
from lcitool.application import Application
from lcitool.commandline import CommandLine