Skip to content

Commit

Permalink
Document required_conan_version for recipes (#1788)
Browse files Browse the repository at this point in the history
* add docs

* add ref
  • Loading branch information
czoido committed Jul 30, 2020
1 parent 44ab6ca commit 9bcfd96
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
26 changes: 25 additions & 1 deletion reference/conanfile/other.rst
Expand Up @@ -88,4 +88,28 @@ Optional parameters:
DYLIB_LIBRARY_PATH are defined in the command execution adding the values of the "lib" and "bin" folders of the dependencies.
Allows executables to be easily run using shared libraries from its dependencies.
- **with_login** (Optional, Defaulted to ``True``): Pass the ``--login`` flag to :command:`bash` command when using ``win_bash`` parameter.
This might come handy when you don't want to create a fresh user session for running the command.
This might come handy when you don't want to create a fresh user session for running the command.

.. _conanfile_required_version:

Requiring a Conan version for the recipe
----------------------------------------

A required Conan version can be declared in the `conanfile.py` using ``required_conan_version`` to
throw an error when the Conan version installed does not meet the criteria established by the
variable. To add ``required_conan_version`` to a `conanfile.py` just declare it before the recipe
class definition:

.. code-block:: python
:emphasize-lines: 3
from conans import ConanFile
required_conan_version = ">=1.27.1"
class Pkg(ConanFile):
settings = "os", "compiler", "arch", "build_type"
...
It is also possible to declare ``required_conan_version`` at configuration level for the whole client
adding it to the :ref:`conan.conf<conan_conf>` file.
3 changes: 2 additions & 1 deletion reference/config_files/conan.conf.rst
Expand Up @@ -224,7 +224,8 @@ configured. It only accepts the follow time intervals: minutes, hours and days.

The ``required_conan_version`` variable validates if the current Conan client version is valid according to its version. When it's not
according to the required version or its range, Conan raises an exception before running any command. It accepts SemVer format, including version range.
This configuration is useful When a company wants to align the Conan client version used by all teams.
This configuration is useful when a company wants to align the Conan client version used by all teams. This can be also specified at
:ref:`recipe level<conanfile_required_version>` if you need adding this information just for certain recipes.

Storage
+++++++
Expand Down

0 comments on commit 9bcfd96

Please sign in to comment.