Version range expressions are supported, both in
conanfile.txt and in
The syntax is using brackets:
class HelloConan(ConanFile): requires = "Pkg/[>1.0,<1.8]@user/stable"
Expressions are those defined and implemented by [python node-semver](https://pypi.python.org/pypi/node-semver), but using a comma instead of spaces. Accepted expressions would be:
>1.1,<2.1 # In such range 2.8 # equivalent to =2.8 ~=3.0 # compatible, according to semver >1.1 || 0.8 # conditions can be OR'ed
Version range expressions are evaluated at the time of building the dependency graph, from downstream to upstream dependencies. No joint-compatibility of the full graph is computed, instead, version ranges are evaluated when dependencies are first retrieved.
This means, that if a package A depends on another package B (A->B), and A has a requirement for
C/[>1.2,<1.8], this requirement is evaluated first and it can lead to get the version
package B has the requirement to
C/[>1.3,<1.6], this one will be overwritten by the downstream one,
it will output a version incompatibility error. But the “joint” compatibility of the graph will not
be obtained. Downstream packages or consumer projects can impose their own requirements to comply
with upstream constraints, in this case a override dependency to
C/[>1.3,<1.6] can be easily defined
in the downstream package or project.
The order of search for matching versions is as follows:
- First, the local conan storage is searched for matching versions, unless the
--updateflag is provided to
- If a matching version is found, it is used in the dependency graph as a solution
- If no matching version is locally found, it starts to search in the remotes, in order. If some
remote is specified with
-r=remote, then only that remote will be used.
- If the
--updateparameter is used, then the existing packages in the local conan cache will not be used, and the same search of the previous steps is carried out in the remotes. If new matching versions are found, they will be retrieved, so subsequent calls to
installwill find them locally and use them.