diff options
-rw-r--r-- | coin_build_instructions.py | 12 | ||||
-rw-r--r-- | coin_test_instructions.py | 13 |
2 files changed, 23 insertions, 2 deletions
diff --git a/coin_build_instructions.py b/coin_build_instructions.py index f3f8d2016..4f006612f 100644 --- a/coin_build_instructions.py +++ b/coin_build_instructions.py @@ -113,7 +113,17 @@ def call_setup(python_ver, phase): 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") 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") |