-
Notifications
You must be signed in to change notification settings - Fork 993
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
Promote to_apple_arch in conan.tools.apple #11915
Promote to_apple_arch in conan.tools.apple #11915
Conversation
Co-authored-by: Luis Martinez <lasote@gmail.com>
'armv8.3': 'arm64e', | ||
'armv7s': 'armv7s', | ||
'armv7k': 'armv7k'}.get(str(arch)) | ||
arch_ = conanfile.settings.get_safe("arch") |
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 am slightly concerned about some recent tools similar to this, as I am wondering what will happen if at some point users want to use it for the build context. They will not be able. So the options would be:
- To expose the underlying dict, something like
apple_archs(arch)
- To create a new
to_apple_arch_build(conanfile)
(a bit ugly?)
I am fine with this change at this moment, but something to have in mind and maybe discuss.
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.
That's a good point! If there's a risk that we may end up with too many small tool functions that have a similar issue, I'd be more inclined to try and sort this out sooner rather than later. to_apple_arch
has very few uses in Conan Center at the moment, so we may have an opportunity to get it right to cover all cases (although we also want to avoid a repeat of the situations where recipes are using it from the "private" module apple.apple
)
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.
there are some other alternatives, like:
- change context in scope via RAII, e.g.
with context_switch(ctx="build"): do something
- provide a nice moniker like
if is_apple_arch(conanfile.build)
whereconanfile.build
isConanFIle
instance with context switched to build
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.
Related #11926
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.
We will move forward with this approach, and add a context_build=False
argument in the future if need to apply to the build context.
Changelog: Feature: Promote
to_apple_arch
in the newconan.tools.apple
module.Docs: conan-io/docs#2722
Closes #11865
Notes:
conan.tools.apple.apple.to_apple_arch
to the new one taking aconanfile
as an argumentconanfile
object in the context), have made those call the private implementation.