diff options
author | Simo Fält <simo.falt@qt.io> | 2020-06-30 15:29:31 +0300 |
---|---|---|
committer | Simo Fält <simo.falt@qt.io> | 2020-07-01 08:55:45 +0300 |
commit | 4c615f2c749e50d157076237d65ed7297fa070b5 (patch) | |
tree | a243ad326a41ba6b7d95db154ac2cfe7cef2b10f /coin_test_instructions.py | |
parent | 5b938290da2cc1ba627dab9b0c362c7159b496b0 (diff) |
Make sure we are calling pinned virtualenv
Installing package to user space is not adding it to path by default.
Change-Id: I561f619a9cfc6713ca511c77312dcf19a4ac753f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'coin_test_instructions.py')
-rw-r--r-- | coin_test_instructions.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/coin_test_instructions.py b/coin_test_instructions.py index 79a788038..16ba601f7 100644 --- a/coin_test_instructions.py +++ b/coin_test_instructions.py @@ -68,7 +68,18 @@ def call_testrunner(python_ver, buildnro): rmtree(_env, True) # Pinning the virtualenv before creating one run_instruction(["pip", "install", "--user", "virtualenv==20.0.25"], "Failed to pin virtualenv") - run_instruction(["virtualenv", "-p", _pExe, _env], "Failed to create virtualenv") + # installing to user base might not be in PATH by default. + env_path = os.path.join(site.USER_BASE, "bin") + v_env = os.path.join(env_path, "virtualenv") + if sys.platform == "win32": + env_path = os.path.join(site.USER_BASE, "Scripts") + v_env = os.path.join(env_path, "virtualenv.exe") + try: + run_instruction([v_env, "--version"], "Using default virtualenv") + except Exception as e: + v_env = "virtualenv" + + run_instruction([v_env, "-p", _pExe, _env], "Failed to create virtualenv") # When the 'python_ver' variable is empty, we are using Python 2 # Pip is always upgraded when CI template is provisioned, upgrading it in later phase may cause perm issue run_instruction([env_pip, "install", "-r", "requirements.txt"], "Failed to install dependencies") |