我想使用setuptools-scm来控制我的包版本。我的setup.py
setuptools.setup(
...
use_scm_version={'write_to': 'my-package/version.py'},
...
)目前我有v0.2标签在我的回购。我创建了新的分支并添加了一些提交。当我运行python setup.py --version创建my-package/version.py文件时,将得到下一个标记v0.3,而不是当前的v0.2
$ SETUPTOOLS_SCM_DEBUG=1 python3 setup.py --version
...
cmd 'git describe --dirty --tags --long --match *.*'
out b'v0.2-1-gb13420a\n'
cmd 'git rev-parse --abbrev-ref HEAD'
out b'feature-version-system\n'
tag v0.2
tag 'v0.2' parsed to {'version': 'v0.2', 'prefix': '', 'suffix': ''}
version pre parse v0.2
version <Version('0.2')>
version v0.2 -> 0.2
scm version <ScmVersion 0.2 d=1 n=gb13420a d=False b=feature-version-system>
config {'version_scheme': 'guess-next-dev', 'local_scheme': 'node-and-date'}
ep ('setuptools_scm.version_scheme', 'guess-next-dev')
ep found: guess-next-dev
ep ('setuptools_scm.local_scheme', 'node-and-date')
ep found: node-and-date
version 0.3.dev1
local_version +gb13420a
0.3.dev1+gb13420a # <- I want to see 0.2.dev1+gb13420a here$ git tag
v0.1
v0.2我认为这是错误的,因为我正在为当前发布标记v0.2所做的更改,但是setuptools_scm说它们属于v0.3。怎么处理呢?
发布于 2020-10-06 06:59:12
现在,setuptools-scm提供了使用发布后方案的选项,请参阅方案段。然后,python setup.py --version和git describe --tag将提供相同的信息(但格式不同)。若要切换到发布后的方案,请在setup.py中包括以下行:
setup(...
use_scm_version={'version_scheme': 'post-release'},
...
)https://stackoverflow.com/questions/56883909
复制相似问题