aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2023-03-10 12:55:53 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-03-13 20:20:16 +0000
commit9ecdb21ad323af5a7d9a7f571fd28e052a231ea5 (patch)
tree950d5676d34285b2617644e49fcbac5caea4fed1
parent7f0897c59ada4bbdc5da45155e4dee1c33fc47f5 (diff)
pyside6-designer: Prepend virtual env path on Windows
Task-number: PYSIDE-2251 Change-Id: I0efe24e5b92bae82c122d156b7dc4e7aca07c957 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> (cherry picked from commit 6361e496af31d346578245687f3823066f0330c5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--sources/pyside-tools/pyside_tool.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/sources/pyside-tools/pyside_tool.py b/sources/pyside-tools/pyside_tool.py
index e06a4eaac..7c1bf1c26 100644
--- a/sources/pyside-tools/pyside_tool.py
+++ b/sources/pyside-tools/pyside_tool.py
@@ -114,10 +114,11 @@ def assistant():
qt_tool_wrapper(ui_tool_binary("assistant"), sys.argv[1:])
-def _append_to_path_var(var, value):
+def _extend_path_var(var, value, prepend=False):
env_value = os.environ.get(var)
if env_value:
- env_value = f'{env_value}{os.pathsep}{value}'
+ env_value = (f'{value}{os.pathsep}{env_value}'
+ if prepend else f'{env_value}{os.pathsep}{value}')
else:
env_value = value
os.environ[var] = env_value
@@ -154,12 +155,12 @@ def designer():
elif sys.platform == 'win32':
# Find Python DLLs from the base installation
if is_virtual_env():
- _append_to_path_var("PATH", os.fspath(Path(sys._base_executable).parent))
+ _extend_path_var("PATH", os.fspath(Path(sys._base_executable).parent), True)
# Add the Wiggly Widget example
wiggly_dir = os.fspath(pyside_dir / 'examples' / 'widgetbinding')
- _append_to_path_var('PYSIDE_DESIGNER_PLUGINS', wiggly_dir)
+ _extend_path_var('PYSIDE_DESIGNER_PLUGINS', wiggly_dir)
taskmenu_dir = os.fspath(pyside_dir / 'examples' / 'designer' / 'taskmenuextension')
- _append_to_path_var('PYSIDE_DESIGNER_PLUGINS', taskmenu_dir)
+ _extend_path_var('PYSIDE_DESIGNER_PLUGINS', taskmenu_dir)
qt_tool_wrapper(ui_tool_binary("designer"), sys.argv[1:])