Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve logic for detecting msys2-based Python (works for 3.11 and 3.… #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cr1901
Copy link

@cr1901 cr1901 commented Nov 10, 2024

…12).

The MSYS2 project standardized sysconfig names for 3.12, resulting in errors such as the following after an upgrade:

$ pdm run -v test.py pipx
INFO: Reusing existing script environment: C:/Users/William/AppData/Local/pdm/pdm/venvs/2fa106ce3fc8b29bf047ce91804516ef
Traceback (most recent call last):
  File "C:/msys64/home/William/Projects/python/pdm/src/pdm/models/in_process/env_spec.py", line 25, in <module>
    print(json.dumps(get_current_env_spec(), indent=2))
                     ^^^^^^^^^^^^^^^^^^^^^^
  File "C:/msys64/home/William/Projects/python/pdm/src/pdm/models/in_process/env_spec.py", line 16, in get_current_env_spec
    "platform": str(Platform.current()),
                    ^^^^^^^^^^^^^^^^^^
  File "C:/msys64/home/William/Projects/python/dep-logic/src/dep_logic/tags/platform.py", line 164, in current
    return cls(os_, Arch.parse(architecture))
                    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:/msys64/home/William/Projects/python/dep-logic/src/dep_logic/tags/platform.py", line 390, in parse
    return cls(arch)
           ^^^^^^^^^
  File "C:/msys64/mingw64/lib/python3.12/enum.py", line 757, in __call__
    return cls.__new__(cls, value)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:/msys64/mingw64/lib/python3.12/enum.py", line 1171, in __new__
    raise ve_exc
ValueError: 'x86_64_msvcrt_gnu' is not a valid Arch

This PR slightly changes the logic introduced by pdm-project/pdm#3158 for detecting the arch in the MSYS2 case (works for 3.12 and while I don't have 3.11 to test right now, I checked that the mingw_x86_64 string also triggers my updated logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant