Skip to content
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

fix prereleases #3454

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions reference/conanfile/attributes/requirements.inc
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,28 @@ Accepted expressions would be:
- 1.1, 1.2, 2.0


If pre-releases are activated, like defining configuration ``core.version_ranges:resolve_prereleases=True``:

.. list-table::
:widths: 25 25 50
:header-rows: 1

* - Expression
- Versions in range
- Versions outside of range
* - [>=1.0 <2]
- 1.0.0-pre.1, 1.0.0, 1.0.1, 1.1, 1.2.3
- 0.2, 2.0-pre.1, 2.0, 2.1, 3.0
* - [<3.2.1]
- 0.1, 1.2, 1.8-beta.1, 2.0-alpha.2, 2.4, 3.1.1
- 3.2.1-pre.1, 3.2.1, 3.2.2, 3.3
* - [>2.0]
- 2.1-pre.1, 2.1, 2.2, 3.1, 14.2
- 1.1, 1.2, 2.0-pre.1, 2.0

.. seealso::

- Check <MISSING PAGE> version_ranges if you want to learn more about version ranges.
- Check <MISSING PAGE> requires() conanfile.py method.
- Check :ref:`tutorial_version_ranges_expressions` version_ranges tutorial section


tool_requires
Expand Down
7 changes: 5 additions & 2 deletions tutorial/versioning/version_ranges.rst
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,11 @@ It is also possible to apply multiple conditions with the OR operator, like ``re
but this kind of complex expressions is not recommended in practice and should only be used in very extreme cases.

Finally, note that pre-releases are not resolved by default. The way to include them in the range is to
explicitly define it like: ``requires = "pkg/[>1- <2.0]"`` or more explicitly with
``requires = "pkg/[>1 <2, include_prerelease=True]"``. This will include 1.5.1-pre1, but exclude 2.0-pre1.
explicitly define it like ``requires = "pkg/[>=1 <2, include_prerelease]"``. This will include 1.0-pre.1 and 1.5.1-pre1, but exclude 2.0-pre1.

While it is possible to hardcode the ``include_prerelease`` in the ``requires`` version, it is not recommended in the general
case. Pre-releases should be opt-in, and it should be controlled by the user, who is the one to decide if they want to
use pre-releases or not. This can be done defining the configuration ``core.version_ranges:resolve_prereleases``.


For more information about valid range expressions go to :ref:`Requires reference <version_ranges_reference>`