Yos
Yos

Reputation: 41

consuming conan latest version

We are working on integration of conan package management into our pipeline.

Our conan package are store in Artifactory.

The convention of our version numbers looks like this:

Minor.Major.Patch-BuildVerison

As we know, for consuming the latest version, need to use

[> Minor.Major.Patch]

into the conanfile.py.

The only way we were able to get a latest version from versions like our convention is to write it like this:

[> Minor.Major.Patch-0]

But our problem happens in situations like the example below:

Let's say these are the version numbers of a package that we try to consume it's latest version:

1.2.3-1

1.2.3-2

1.2.3-3

if we write in our conanfile.py

[>1.2.3-0]

we will get the

1.2.3-3

as well.

But if we upload the version

1.2.4-1

of thus package (only update the Patch number), and we leave the conanfile.py as is - we will still get the

1.2.3-3

not the

1.2.4-1

as accepted.

Please help us know what is the best way to get what we want.

Thanks.

Upvotes: 0

Views: 1019

Answers (1)

jgsogo
jgsogo

Reputation: 726

Conan v.1.10 introduced two new options associated with version ranges (from the docs):

  • loose: to include/exclude valid semver string checking (defaulted to True)
  • include_prerelease: to include/exclude prerelease versions in the search range (defaulted to False)

Use these options to have more fine-grained control over requirements:

class HelloConan(ConanFile):
   requires = "Pkg/[~1.2.3,loose=False,include_prerelease=True]@user/stable"

Upvotes: 1

Related Questions