Commit f8828ec
setup.py: fail fast if the version can not be determined, fixes #7259
setuptools_scm computes the borg version from git tags. In a shallow clone or a
clone without tags it does not fail the build, it just yields a wrong version
like 0.1.dev1+gedcff4f - and that is only noticed after cythonizing and
compiling everything, which wastes >5min of CI time for nothing.
So ask setuptools_scm for the version before building anything, rather than
reimplementing its tag lookup here:
- shallow repository: use setuptools_scm's own fail_on_shallow pre_parse hook,
which also catches a shallow clone that does happen to have a tag (the
distance would be wrong there). Passed as a get_version() argument, not put
into pyproject.toml, because the "scm" table only exists in recent
setuptools-scm and older ones hard-fail on unknown keys there, see #10193.
- no tags at all: a full clone with the tags deleted is not shallow, so
fail_on_shallow does not catch it. setuptools_scm falls back to a 0.x tag
there and borg has no 0.x releases, so that is what we look at.
- no version source at all: setuptools_scm raises its own helpful error, just
much earlier than before.
Builds that get their version from SETUPTOOLS_SCM_PRETEND_VERSION or from a
sdist's PKG-INFO are not affected, and neither are ReadTheDocs builds.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent 9a6d4cf commit f8828ec
1 file changed
Lines changed: 75 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
48 | 123 | | |
49 | 124 | | |
50 | 125 | | |
| |||
0 commit comments