Skip to content

Commit ecc5f09

Browse files
committed
improving version-ranges docs
1 parent 94b13de commit ecc5f09

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

mastering/version_ranges.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,22 @@ Version ranges
66

77
Version range expressions are supported, both in ``conanfile.txt`` and in ``conanfile.py`` requirements.
88

9-
The syntax is using brackets:
9+
The syntax is using brackets. The square brackets are the way to specify conan that is a version range. Otherwise, versions are plain strings, they can be whatever you want them to be (up to limitations of length and allowed characters).
1010

1111
.. code-block:: python
1212
1313
class HelloConan(ConanFile):
1414
requires = "Pkg/[>1.0,<1.8]@user/stable"
1515
16-
Expressions are those defined and implemented by [python node-semver](https://pypi.python.org/pypi/node-semver),
16+
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.
18+
19+
There are some packages that do not follow semver, a popular one would be the OpenSSL package with versions as ``1.0.2n``. They cannot be used with version-ranges, to require such packages you always have to use explicit versions (without brackets).
20+
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+
23+
24+
Expressions are those defined and implemented by https://pypi.python.org/pypi/node-semver,
1725
but using a comma instead of spaces. Accepted expressions would be:
1826

1927
.. code-block:: python

0 commit comments

Comments
 (0)