[feature] Better set_version example in documentation
- Dominant language
- C++
- Stars
- 125
- Forks
- 382
- Avg merge
- 22h 39m
- Merged PRs (30d)
- 21
Description
It would be nice to have a set_version example in the documentation that promotes semver tags. This also matches version convention supported by CMake:
~~~
project(
[VERSION [.[.[.]]]]
~~~
~~~python
def set_version(self):
""" Set version from last Git tag v...
Extra commits on top of the tag add . number for the final version.
"""
git = tools.Git(folder=self.recipe_folder)
tag = git.run('describe --match v*')
m_release = re.search(r'v(\d+.\d+.\d+)', tag)
m_develop = re.search(r'-(\d+)', tag)
self.version = m_release.group(1)
if m_develop:
self.version += '.' + m_develop.group(1)
~~~
- [x] I've read the [CONTRIBUTING guide](https://github.com/conan-io/conan/blob/develop/.github/CONTRIBUTING.md).
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.