python-versioneer: Tag prefix broken on Windows with versioneer 0.21
https://github.com/python-versioneer/python-versioneer/pull/262 contains a fix for handling * on windows unfortunately this breaks detecting the correct version for me.
In our repository https://github.com/qcodes/qcodes all tags are prefixed with v
and we have tag_prefix = v
this used to work fine however with the latest release of versioneer we get versions reported as unknown + x
Looking at the generated git describe
command we see
git describe --tags --always --long --dirty --match v*
v0.29.0-288-g9f93a1286
git describe --tags --always --long --dirty --match v\*
9f93a1286
git describe --tags --always --long --dirty --match v\\*
9f93a1286
so it would seem like the escape of * does not always work correctly. removing the escaped prefix for windows restores normal functionality for us
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 4
- Comments: 15 (5 by maintainers)
Commits related to this issue
- versioneer fix for https://github.com/python-versioneer/python-versioneer/issues/273 — committed to jenshnielsen/Qcodes by jenshnielsen 3 years ago
@hwjohn I’ll take that into account and also see if the tag prefix works consistently on all platforms if it is provided.
@mathijsvdv , I would be grateful if you provided a fix.
I think a better solution than what is currently implemented in #274 is to just omit the
--match
option entirely from thegit
command if there is no tag prefix. This will avoid any issues with trying to predict the correct escape sequence for a given platform.AFAIK it is not required to escape the search string as it actually breaks functionality as I get no tag despite the fact I am at the exact commit with the tag, see below from a PowerShell prompt:
So I am getting 0+untagged.87.g6408ff9 where I would expect 2022.01.1
I would think that is a separate issue. To debug I would suggest that you confirm that the the
git describe function
returns something meaningful if you run it from the git bash command line. You can see here https://github.com/python-versioneer/python-versioneer/blob/master/src/git/from_vcs.py#L39 which command versioneer executes