question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[2.0] [feature/feedback] conans.model.version.Version needs to be converted to str

See original GitHub issue

When downloading source using conan.tools.files.get, we are using the conandata.yml to store url depending on the recipe version.

This result in this pattern:

class MyPackageConan(ConanFile):
    name = "my-package"
    version = "1.0.0"

    def source(self):
        files.get(self, **self.conan_data["sources"][self.version], strip_root=True)

However, in this case, conan will complain with this error:

ERROR: my-package/1.0.0: Error in source() method, line 20
	files.get(self, **self.conan_data["sources"][self.version], strip_root=True)
	KeyError: 1.0.0

Proposition:

Make Version convert to str as we had for 1.0.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
memshardedcommented, Feb 7, 2022

Implemented in https://github.com/conan-io/conan/pull/10519, to be in next alpha 4

1reaction
memshardedcommented, Feb 4, 2022

We have discussed this, and we have decided to leave the “str” type as base. People wanting to use self.version for full comparisons can:

  • Explicitly convert to Version(self.version)
  • Use self.ref.version
Read more comments on GitHub >

github_iconTop Results From Across the Web

conan-server version 2.0.0b3 does not start #12128 - GitHub
This is a conan 2.0.0-beta issue. I hope, this issue tracker is for 2.0 development issues, too. (Haven't found any information about ...
Read more >
Conan migration guide to 2.0 — conan 1.53.0 documentation
The recipes have to be updated to be compatible with Conan 2.0. There are 2.0 features ported to Conan 1.X so you can...
Read more >
Conan API - GitLab Docs
This is the API documentation for Conan Packages. This API is used by the Conan ... package_version, string, yes, Version of a package....
Read more >
Botpress can process the user uploaded file? - IssueHint
YOU MAY BE INTERESTED ; Correction on SQL call, 2, 2021-11-18 ; [2.0] [feature/feedback] conans.model.version.Version needs to be converted to str ...
Read more >
[2.0] [feature/feedback] conans.model.version.Version needs to be ...
Make Version convert to str as we had for 1.0. To clarify, you want the new Version class to have a __str__ method,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found