#465 Use setuptools-scm to get version with a git tag - #510
Conversation
|
@sschuberth for your review for #465 |
fb47886 to
7242b65
Compare
|
Cool, just today I was missing that feature again! But even after reading about the scheme I'm having difficulties to understand how exactly it works. For my local repo (with some custom merges) I get Also, even after creating local (lightweight and annotated) tags, I still see the "distance" part of "101", and the tag name not being picked up. Finally, I believe in our case the "dev" prefix is misleading as one could misunderstand it to refer to the "develop" branch, which it does not. I'd prefer to make the scheme match exactly the one of Note that there seems to be a bug in the documentation of setuptools_scm as |
|
2.0.0rc3 comes either from the |
|
The setuptools_scm docs say the default scheme to use |
|
@sschuberth would you know what to do to get this behavior then? |
|
After reading through this post it seems the solution is to not set But that still does not seem to work fully. While I now see strings like when running Not sure why there's |
|
FYI, I've also added a comment about the misleading "g" here. |
|
@sschuberth Thanks. wrt to the |
|
@sschuberth setuptools_scm is too sophisticated. I just added a few extra lines in setup.py to the same (controllable) effect. |
| # this may fail with exceptions | ||
| cmd = 'git', 'describe', '--tags', '--long', '--dirty', | ||
| version = check_output(cmd, stderr=STDOUT).strip() | ||
| dirty = version.endswith('-dirty') |
There was a problem hiding this comment.
Funny, that's basically exactly the same that I've implemented meanwhile in setuptools_scm :-)
There was a problem hiding this comment.
ah! sorry... I had not tracked you were submitting a PR there. If we can switch back to setuptools_scm later this would be great. Though it does not handle any fallback to a default version...
There was a problem hiding this comment.
No, I was no meaning to say you should continue using setuptools_scm. It will take me more time (and be convincing) to shape it into what I'd expect ;-)
| __version__ = get_distribution('scancode-toolkit').version | ||
| except DistributionNotFound: | ||
| # package is not installed ?? | ||
| __version__ = '2.0.0rc3' |
There was a problem hiding this comment.
Is there a way to use the version from setup.py so the fallback is only hard-coded once?
There was a problem hiding this comment.
This is what should happen, but I am playing it safe. The versions are updated at once in all places with bumpversion in anycase
|
So I just tried the latest state. With this, the version may look like or Personally, I don't like the So, bottom line, how about this instead: and ? |
|
Please update as you please ... The only constraint would be to ensure that this ends up being compliant with https://www.python.org/dev/peps/pep-0440/ and that its sorts well. |
d296b7b to
9dfe1dd
Compare
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
9dfe1dd to
830cc92
Compare
* do not use setuptools_scm * collect git describe and fallback to default version * get version as installed in scancode or fallback to default too. Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
830cc92 to
9e8a9e9
Compare
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
bbcaaa7 to
0df8a27
Compare
|
I made a few tests with your proposed scheme: and
and
So net-net is that dashes are in all cases replaced by dots or creating a non-compliant version wrt. PEP440. '2.0.0rc2.post111+0df8a27.dirty.20170226175122' is the scheme that works and sorts. Let's go with this for now. |
Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Philippe Ombredanne pombredanne@nexb.com