You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: mastering/version_ranges.rst
+10-10Lines changed: 10 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ The syntax is using brackets. The square brackets are the way to specify conan t
11
11
.. code-block:: python
12
12
13
13
classHelloConan(ConanFile):
14
-
requires ="Pkg/[>1.0,<1.8]@user/stable"
14
+
requires ="Pkg/[>1.0<1.8]@user/stable"
15
15
16
16
17
17
So when specifying ``Pkg/[expression]@user/stable`` it means that ``expression`` will be evaluated as a version range. Otherwise it will be understand as plain text, so ``requires = "Pkg/version@user/stable"`` always means to use the version ``version`` literally.
@@ -21,26 +21,26 @@ There are some packages that do not follow semver, a popular one would be the Op
21
21
The process to manage plain versions vs version-ranges is also different. The second one requires a "search" in the remote, which is orders of magnitude slower than direct retrieval of the reference (plain versions), so take it into account if you plan to use it for very large projects.
22
22
23
23
24
-
Expressions are those defined and implemented by https://pypi.org/project/node-semver/,
25
-
but using a comma instead of spaces. Accepted expressions would be:
24
+
Expressions are those defined and implemented by https://pypi.org/project/node-semver/. Accepted expressions would be:
26
25
27
26
.. code-block:: python
28
27
29
-
>1.1,<2.1# In such range
30
-
2.8# equivalent to =2.8
31
-
~=3.0# compatible, according to semver
32
-
>1.1||0.8# conditions can be OR'ed
28
+
[>1.1<2.1] # In such range
29
+
[2.8] # equivalent to =2.8
30
+
[~=3.0] # compatible, according to semver
31
+
[>1.1||0.8] # conditions can be OR'ed
32
+
[1.2.7 ||>=1.2.9 <2.0.0] # This range would match the versions 1.2.7, 1.2.9, and 1.4.6, but not the versions 1.2.8 or 2.0.0.
33
33
34
34
Version range expressions are evaluated at the time of building the dependency graph, from
35
35
downstream to upstream dependencies. No joint-compatibility of the full graph is computed, instead,
36
36
version ranges are evaluated when dependencies are first retrieved.
37
37
38
38
This means, that if a package A depends on another package B (A->B), and A has a requirement for
39
-
``C/[>1.2,<1.8]``, this requirement is evaluated first and it can lead to get the version ``C/1.7``. If
40
-
package B has the requirement to ``C/[>1.3,<1.6]``, this one will be overwritten by the downstream one,
39
+
``C/[>1.2<1.8]``, this requirement is evaluated first and it can lead to get the version ``C/1.7``. If
40
+
package B has the requirement to ``C/[>1.3<1.6]``, this one will be overwritten by the downstream one,
41
41
it will output a version incompatibility error. But the "joint" compatibility of the graph will not
42
42
be obtained. Downstream packages or consumer projects can impose their own requirements to comply
43
-
with upstream constraints, in this case a override dependency to ``C/[>1.3,<1.6]`` can be easily defined
43
+
with upstream constraints, in this case a override dependency to ``C/[>1.3<1.6]`` can be easily defined
44
44
in the downstream package or project.
45
45
46
46
The order of search for matching versions is as follows:
0 commit comments