From 9fee7449e605fce14084cd41f9b4a7bc3f874edc Mon Sep 17 00:00:00 2001 From: Aparna Jyothi Date: Fri, 13 Jun 2025 17:15:00 +0530 Subject: [PATCH] updated script --- __tests__/verify_windows_install_path_user.py | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/__tests__/verify_windows_install_path_user.py b/__tests__/verify_windows_install_path_user.py index c0f65c8b..46bf7883 100644 --- a/__tests__/verify_windows_install_path_user.py +++ b/__tests__/verify_windows_install_path_user.py @@ -3,7 +3,12 @@ import sys import re def build_expected_path(python_version, architecture, freethreaded): - # Extract major and minor from full version like "3.13.1" or "3.14.0-beta.2" + print("Inputs received:") + print(f" Python Version : {python_version}") + print(f" Architecture : {architecture}") + print(f" Freethreaded : {freethreaded}") + + # Extract major and minor from version like "3.13.1" or "3.14.0-beta.2" match = re.match(r"^(\d+)\.(\d+)", python_version) if not match: print(f"Invalid python version format: {python_version}") @@ -25,7 +30,9 @@ def build_expected_path(python_version, architecture, freethreaded): version_suffix += "-arm64" base_path = os.getenv("APPDATA", "") - return os.path.join(base_path, "Python", f"Python{version_suffix}", "Scripts") + full_path = os.path.join(base_path, "Python", f"Python{version_suffix}", "Scripts") + print(f"Constructed expected path: {full_path}") + return full_path def main(): if len(sys.argv) != 4: @@ -37,14 +44,14 @@ def main(): freethreaded = sys.argv[3] expected_path = build_expected_path(python_version, architecture, freethreaded) - print(f"Expected PATH entry: {expected_path}") + print("Validating against PATH environment variable...") path_env = os.getenv("PATH", "") - if expected_path.lower() not in path_env.lower(): + if expected_path.lower() in path_env.lower(): + print("Correct path present in PATH") + else: print("Expected path not found in PATH") sys.exit(1) - else: - print("Correct path present in PATH") if __name__ == "__main__": - main() \ No newline at end of file + main()