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
Feature/min conan version #7360
Feature/min conan version #7360
Conversation
Nor really requesting changes, but I would like to wait for feedback on #7138 (comment). Those are my concerns about this feature.
This PR proposes the simple syntax: from conans import ConanFile
min_conan_version = "1.26"
class Lib(ConanFile):
pass Max version is not possible, |
As discussed earlier today, let's converge this to the same name and version range used in conan.conf |
Maybe the name of conans/test/functional/conanfile/min_version_test.py
and MinVersionTest
should be changed to conans/test/functional/conanfile/required_version_test.py
and RequiredConanVersionTest
?
Agree, names changed |
def validate_conan_version(required_range): | ||
result = satisfies(client_version, required_range, loose=True) | ||
if not result: | ||
raise ConanException("The current Conan version ({}) does not match to the required" |
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.
raise ConanException("The current Conan version ({}) does not match to the required" | |
raise ConanException("The current Conan version ({}) does not match the recipe required" |
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 see this message is used to raise from Conan required version from config as well as from recipe, but would like a more clear message about it
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.
Cannot be changed, because it is common.
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 have improved the message grammar, and added a capture of the error, so when you are reading a conanfile of a dependency it will throw and print:
pkg/version@user/channel: ERROR: Cannot load recipe
The conanfile at path .... version not satisfied message
This feature will make my life so much better... I didn't even know I needed this |
Happy to know it. Available now in Conan 1.28 just released. Remember that you also have the |
|
Changelog: Feature: Implement
required_conan_version
inconanfile.py
, will raise if the current Conan version does not match the defined version range.Docs: conan-io/docs#1788
Proposal for discussing #7138