In some conanfile.py, I would like to customize some steps depending on the version of the compiler (or some other elements). And I didn't find a proper way to compare versions.
Is it possible to add in Tools the version comparer that conan uses internally ?
Actually using conan 1.8.1
To help us debug your issue please explain:
Hi @dkgs !
one possible approach:
def configure(self):
if self.settings.compiler == "gcc" and \
float(settings.compiler.version.value) < 5:
raise ConanInvalidConfiguration("This project does not support GCC < 5")
but there is a better approach:
from conans.model.version import Version
...
def configure(self):
if self.settings.compiler == "gcc" and \
Version(self.settings.compiler.version.value) < "5.0":
raise ConanInvalidConfiguration("This project does not support GCC < 5")
Check also this how to: https://docs.conan.io/en/latest/howtos/check_conan_version_in_conanfile.html
Waow I completely missed that part !
Thansk !
Most helpful comment
Check also this how to: https://docs.conan.io/en/latest/howtos/check_conan_version_in_conanfile.html