2018-01-31 18:58:52 +00:00
|
|
|
diff --git a/bin/qshell b/bin/qshell
|
|
|
|
index 2ba7e61c..0ac2a2ef 100755
|
|
|
|
--- a/bin/qshell
|
|
|
|
+++ b/bin/qshell
|
|
|
|
@@ -28,5 +28,6 @@ base_dir = os.path.abspath(os.path.join(this_dir, ".."))
|
|
|
|
sys.path.insert(0, base_dir)
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
+ __import__("importlib").import_module("libqtile.utils").restore_os_environment()
|
|
|
|
from libqtile.scripts import qshell
|
|
|
|
qshell.main()
|
2015-12-01 11:46:18 +00:00
|
|
|
diff --git a/bin/qtile b/bin/qtile
|
2018-01-31 18:58:52 +00:00
|
|
|
index 3e82814d..335b5cea 100755
|
2015-12-01 11:46:18 +00:00
|
|
|
--- a/bin/qtile
|
|
|
|
+++ b/bin/qtile
|
2018-01-31 18:58:52 +00:00
|
|
|
@@ -29,5 +29,6 @@ base_dir = os.path.abspath(os.path.join(this_dir, ".."))
|
|
|
|
sys.path.insert(0, base_dir)
|
2015-12-01 11:46:18 +00:00
|
|
|
|
2018-01-31 18:58:52 +00:00
|
|
|
if __name__ == '__main__':
|
2015-12-01 11:46:18 +00:00
|
|
|
+ __import__("importlib").import_module("libqtile.utils").restore_os_environment()
|
2018-01-31 18:58:52 +00:00
|
|
|
from libqtile.scripts import qtile
|
|
|
|
qtile.main()
|
2015-12-01 11:46:18 +00:00
|
|
|
diff --git a/bin/qtile-run b/bin/qtile-run
|
2018-01-31 18:58:52 +00:00
|
|
|
index e4b121be..1c203bc9 100755
|
2015-12-01 11:46:18 +00:00
|
|
|
--- a/bin/qtile-run
|
|
|
|
+++ b/bin/qtile-run
|
2018-01-31 18:58:52 +00:00
|
|
|
@@ -8,5 +8,6 @@ base_dir = os.path.abspath(os.path.join(this_dir, ".."))
|
|
|
|
sys.path.insert(0, base_dir)
|
2015-12-01 11:46:18 +00:00
|
|
|
|
2018-01-31 18:58:52 +00:00
|
|
|
if __name__ == '__main__':
|
2015-12-01 11:46:18 +00:00
|
|
|
+ __import__("importlib").import_module("libqtile.utils").restore_os_environment()
|
2018-01-31 18:58:52 +00:00
|
|
|
from libqtile.scripts import qtile_run
|
|
|
|
qtile_run.main()
|
|
|
|
diff --git a/bin/qtile-top b/bin/qtile-top
|
|
|
|
index 5316e0e7..272c6430 100755
|
|
|
|
--- a/bin/qtile-top
|
|
|
|
+++ b/bin/qtile-top
|
|
|
|
@@ -8,5 +8,6 @@ base_dir = os.path.abspath(os.path.join(this_dir, ".."))
|
|
|
|
sys.path.insert(0, base_dir)
|
2015-12-01 11:46:18 +00:00
|
|
|
|
2018-01-31 18:58:52 +00:00
|
|
|
if __name__ == '__main__':
|
|
|
|
+ __import__("importlib").import_module("libqtile.utils").restore_os_environment()
|
|
|
|
from libqtile.scripts import qtile_top
|
|
|
|
qtile_top.main()
|
2015-12-01 11:46:18 +00:00
|
|
|
diff --git a/libqtile/utils.py b/libqtile/utils.py
|
2018-05-24 16:23:47 +01:00
|
|
|
index 550ed02677e..1358a66f3df 100644
|
2015-12-01 11:46:18 +00:00
|
|
|
--- a/libqtile/utils.py
|
|
|
|
+++ b/libqtile/utils.py
|
2018-05-24 16:23:47 +01:00
|
|
|
@@ -272,3 +272,11 @@ def safe_import(module_names, class_name, globals_, fallback=None):
|
|
|
|
logger.debug("%s", traceback.format_exc())
|
|
|
|
if fallback:
|
|
|
|
globals_[class_name] = fallback(module_path, class_name, error)
|
2016-02-15 12:15:48 +00:00
|
|
|
+
|
2015-12-01 11:46:18 +00:00
|
|
|
+
|
|
|
|
+def restore_os_environment():
|
|
|
|
+ pythonpath = os.environ.pop("QTILE_SAVED_PYTHONPATH", "")
|
|
|
|
+ os.environ["PYTHONPATH"] = pythonpath
|
|
|
|
+ path = os.environ.pop("QTILE_SAVED_PATH", None)
|
|
|
|
+ if path:
|
|
|
|
+ os.environ["PATH"] = path
|