-
Notifications
You must be signed in to change notification settings - Fork 239
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
set VSCMD_ARG_TGT_ARCH based on targetted architecture #1876
set VSCMD_ARG_TGT_ARCH based on targetted architecture #1876
Conversation
4ee16c8
to
c8a6e53
Compare
This comment has been minimized.
This comment has been minimized.
@henryiii - I'd welcome your feedback on this suggestion please. |
I've always been in favor of this, it's just been others that are worried that setting this variable will make some build backend confused about not having the others. |
I don't know enough to really have an informed opinion here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay with this, it seems to me to be very similar to _PYTHON_HOST_PLATFORM/ARCHFLAGS that we set in macos.py.
I don't have any specific knowledge of the MS compiler to predict and second-order effects though. @zooba, since you created the cross-compilation mechanism, do you have an opinion on the use of VSCMD_ARG_TGT_ARCH for cross-compilation?
This seems harmless, provided we aren't replacing an existing value for the variable. If it's been set, we have to assume that cross-compilation is configured across a range of settings (particularly LIB and PATH environment variables) and bail out (or use it to automatically select the set of builds to run...?) Other than that, seems fine. I don't think anything but setuptools takes this into account, but it's as "standard" as things get. Anything else will be backend-specific. |
I think this is done now (?) - I've updated the tests to expect the FatalError and can't think of anything else to do in the main code |
for more information, see https://pre-commit.ci
Co-authored-by: Joe Rickerby <[email protected]>
ad64d98
to
fba21a9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
This fixes #1861 and any other build setups which make use of
setuptools._distutils.util.get_platform()
on windowsApproach
dict
lookup pattern analog to many other places within the codeFatalError
if the variable is preset to a different value than expected.VSCMD_ARG_TGT_ARCH=""
monkeypatch
the environment before callingsetuptools._distutils.util.get_platform()
and validating returned platformTest availability
os.name
in a tight context worked locally (Win11 + WSL2 + Ubunutu 22.04), but fails in pipeline on github actionsPotential refactoring idea for a future PR
dataclass
- there are many places with the patternsomevar = architecture_mapping_dict[arch]
which would be more readable assomevar = targetarchitecure.somevar