-
Notifications
You must be signed in to change notification settings - Fork 989
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
config of package_id default mode #4644
config of package_id default mode #4644
Conversation
This one is targeting (and closing) #4071, isn't it? |
conans/client/conf/__init__.py
Outdated
try: | ||
return self.get_item("general.package_id_mode") | ||
except ConanException: | ||
return None |
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.
Should the value be None
or semver
? Why not present in the conan.conf
? I would like to see default_package_id_mode=semver
explicit, always. In case someone doesn't have it, return "semver" instead of None
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.
The values shouldn't contain the "_mode" suffix.
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 would like to see the possible values as comments in the conan.conf too. I even like the idea of having a link to the docs section if we feel this feature is important enough...
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.
It is different to not define a new default_package_id_mode, than defining it to semver. This is the logic:
# sha values
if package_id_mode:
try:
getattr(self, package_id_mode)()
except AttributeError:
raise ConanException("'%s' is not a known package_id_mode" % package_id_mode)
else:
if indirect:
self.unrelated_mode()
else:
self.semver_mode()
So if defaults to semver
it will never apply the current unrelated_mode()
that is applying to indirect (transitive, but not declared) dependencies, changing the current behavior.
Maybe we need to discuss this, but I thought that the new default mode would apply to all dependencies, transitive indirect dependencies too.
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 really fail to see the whole picture now, so I will need a brief explanation
conans/model/info.py
Outdated
""" parse the input into fields name, version... | ||
""" | ||
pref = PackageReference.loads(value_str) | ||
def __init__(self, pref, indirect=False, package_id_mode=None): |
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 think package_id_mode
shouldn't be optional.
A comment about naming: I think it should resemble the naming we already have documented: |
One thing is the mode in the config, and a different one is the helpers in the package_id. |
Totally redundant, but the user will search for I'm just commenting these things in case you haven't realized about them; naming is hard, keeping the docs updated too, linking one section of the docs with other sections is also important. I think that having the same naming for the strings that the user has to manage is better, I'm not saying anything about the naming of the variables. But let's ping @danimtb, as the guardian of the docs his opinion about naming is important too. |
Although it may be redundant, I think it is better to keep the same naming as in that section. Users are not very used to this kind of use cases and I think the section is well documented, so having to explain the modes twice is not necessary. I am not sure about the |
Totally opposed to |
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.
Pending create and document a new mode describing the default behavior and introduce it as the default, visible, in the conan.conf and return it instead of the None
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.
Conficts!
Changelog: Feature: Allow configuring in conan.conf a different default
package_id
mode.Docs: conan-io/docs#1106
Close #4071