aboutcode-org / aboutcode-org/skeleton

Use correct PEP 440 fallback version

Offen
#86 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
9
Forks
9
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

The current fallback version generates an incorrect result when git `export-subst` is applied to replace the placeholders; and pip and setuptools complain with this error message (when using fetchcode@0.3.0 to explore the process):

```
setuptools.extern.packaging.version.InvalidVersion: Invalid version: '9999.d0a3fa9-2023-12-19'
```

We should instead use this modified fallback version:

```
fallback_version = "9999+$Format:%h$"
```

See, e.g.,
- https://peps.python.org/pep-0440/
- https://packaging.python.org/en/latest/specifications/version-specifiers/#local-version-identifiers
- https://git-scm.com/docs/gitattributes#_creating_an_archive

and
- https://github.com/nexB/fetchcode/blob/v0.3.0/pyproject.toml#L8 (example of our current fallback version syntax -- this generated the `InvalidVersion` error noted above)

```
[tool.setuptools_scm]
# this is used populated when creating a git archive
# and when there is .git dir and/or there is no git installed
fallback_version = "9999.$Format:%h-%cs$"
```

- https://github.com/nexB/fetchcode/blob/v0.3.0/.gitattributes

```
# Ignore all Git auto CR/LF line endings conversions
* -text
pyproject.toml export-subst
```

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.