Skip to content

[feature] Better set_version example in documentation #1920

Open
@klimkin

Description

@klimkin

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(<PROJECT-NAME>
        [VERSION <major>[.<minor>[.<patch>[.<tweak>]]]]
    def set_version(self):
        """ Set version from last Git tag v<major>.<minor>.<patch>.
        Extra commits on top of the tag add .<tweak> 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)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions