swh:1:snp:03e8cdabc80bf6f4ef54d117858809e20088601c
Raw File
Tip revision: 4c66208245db29be8b9920434d6d48d23b29e367 authored by Bryna Hazelton on 01 July 2021, 18:47:33 UTC
fix tutorial error
Tip revision: 4c66208
branch_scheme.py
# -*- mode: python; coding: utf-8 -*-
# Copyright (c) 2020 Radio Astronomy Software Group
# Licensed under the 2-clause BSD License

"""Define branch_scheme for versioning."""


def branch_scheme(version):  # pragma: nocover
    """
    Local version scheme that adds the branch name for absolute reproducibility.

    If and when this is added to setuptools_scm this function and file can be removed.
    """
    if version.exact or version.node is None:
        return version.format_choice("", "+d{time:{time_format}}", time_format="%Y%m%d")
    else:
        if version.branch == "main":
            return version.format_choice("+{node}", "+{node}.dirty")
        else:
            return version.format_choice("+{node}.{branch}", "+{node}.{branch}.dirty")
back to top