From 27edd1cac511006ba8ebb3aba71ffc5bcb35c047 Mon Sep 17 00:00:00 2001 From: anssakthi Date: Thu, 5 Sep 2024 14:20:07 +0530 Subject: [PATCH 1/2] wip --- .github/workflows/ci_cd.yml | 2 +- src/ansys/tools/installer/installed_table.py | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 61bb8fc1..c16e6323 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -6,7 +6,7 @@ on: tags: - "*" branches: - - main + - issue/343 env: MAIN_PYTHON_VERSION: '3.11' diff --git a/src/ansys/tools/installer/installed_table.py b/src/ansys/tools/installer/installed_table.py index cb246f78..5669495f 100644 --- a/src/ansys/tools/installer/installed_table.py +++ b/src/ansys/tools/installer/installed_table.py @@ -541,6 +541,16 @@ def launch_cmd( always_use_pip : bool, default: False Whether to always use pip for the command or not. """ + path = os.environ["PATH"].split(";") + altered_path = path.copy() + for p in path: + if ( + "Ansys Python Manager\_internal" in p + or "ansys_python_manager\_internal" in p + ): + altered_path.remove(p) + myenv = ";".join(altered_path) + # Handle unexpected bool parameter for linux if is_linux_os() and isinstance(extra, bool): extra = "" @@ -567,7 +577,8 @@ def launch_cmd( if is_vanilla_python and not is_venv: scripts_path = os.path.join(py_path, "Scripts") - new_path = f"{py_path};{scripts_path};%PATH%" + + new_path = f"{py_path};{scripts_path};{myenv}" if extra: cmd = f"&& {extra}" @@ -591,7 +602,7 @@ def launch_cmd( run_linux_command(py_path, extra, True) else: subprocess.call( - f'start {min_win} cmd /K "{py_path}\\Scripts\\activate.bat && cd %userprofile% {cmd}"', + f'start {min_win} cmd /K "set PATH={myenv} && {py_path}\\Scripts\\activate.bat && cd %userprofile% {cmd}"', shell=True, ) elif not is_vanilla_python and is_venv: @@ -608,7 +619,7 @@ def launch_cmd( run_linux_command_conda(py_path, extra, True) else: subprocess.call( - f'start {min_win} cmd /K "{miniforge_path}\\Scripts\\activate.bat && conda activate {py_path} && cd %userprofile% {cmd}"', + f'start {min_win} cmd /K "set PATH={myenv} && {miniforge_path}\\Scripts\\activate.bat && conda activate {py_path} && cd %userprofile% {cmd}"', shell=True, ) else: @@ -625,6 +636,6 @@ def launch_cmd( run_linux_command_conda(py_path, extra, False) else: subprocess.call( - f'start {min_win} cmd /K "{miniforge_path}\\Scripts\\activate.bat && conda activate {py_path} && cd %userprofile% {cmd}"', + f'start {min_win} cmd /K "set PATH={myenv} && {miniforge_path}\\Scripts\\activate.bat && conda activate {py_path} && cd %userprofile% {cmd}"', shell=True, ) From f48011e4a8aaf2346b57d06faef88019040f8af3 Mon Sep 17 00:00:00 2001 From: Sakthi Prakash R <151930473+anssakthi@users.noreply.github.com> Date: Thu, 5 Sep 2024 15:35:00 +0530 Subject: [PATCH 2/2] Update ci_cd.yml --- .github/workflows/ci_cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index c16e6323..61bb8fc1 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -6,7 +6,7 @@ on: tags: - "*" branches: - - issue/343 + - main env: MAIN_PYTHON_VERSION: '3.11'