Commit 4c2cf6e
committed
Fix parsing .git_archival.txt for archives made from tagged commits.
Given .git_archival.txt content like this:
node: 3634907645428b9542cfb4fd1ceef08f14526cb8
node-date: 2022-10-13T20:38:09-06:00
describe-name: v0.0.5
ref-names: HEAD -> main, tag: v0.0.5
we would previously fail with an exception like this:
$ python3 -m setuptools_scm
Traceback (most recent call last):
[..snip..]
File ".../setuptools_scm/git.py", line 312, in parse_archival
return archival_to_version(data, config=config)
File ".../setuptools_scm/git.py", line 286, in archival_to_version
tag, number, node, _ = _git_parse_describe(archival_describe)
File ".../setuptools_scm/git.py", line 245, in _git_parse_describe
tag, number, node = describe_output.rsplit("-", 2)
ValueError: not enough values to unpack (expected 3, got 1)
The problem is that the describe-name field is "v0.0.5" instead of
looking like "v0.0.5-0-g3634907".
When we invoke git-describe ourselves, we specify the --long option, but
the format-strings implemented by git-archive do not currently give us
any way to force long-output in a .git_archival.txt file.
This change detects this condition and returns None for the missing
fields.1 parent 9a79676 commit 4c2cf6e
2 files changed
+13
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
235 | | - | |
| 235 | + | |
236 | 236 | | |
237 | 237 | | |
| 238 | + | |
| 239 | + | |
238 | 240 | | |
239 | 241 | | |
240 | 242 | | |
241 | 243 | | |
242 | 244 | | |
243 | 245 | | |
244 | 246 | | |
245 | | - | |
246 | | - | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
247 | 256 | | |
248 | 257 | | |
249 | 258 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
523 | 523 | | |
524 | 524 | | |
525 | 525 | | |
| 526 | + | |
526 | 527 | | |
527 | 528 | | |
528 | 529 | | |
| |||
0 commit comments