From b7d4950426328ab02aefcef3783edf0fb74e2928 Mon Sep 17 00:00:00 2001 From: "A bot of @njzjz" <48687836+njzjz-bot@users.noreply.github.com> Date: Fri, 21 Jun 2024 01:09:12 -0400 Subject: [PATCH] feat(build): Add Git archives version files (#469) When downloading the source code of a branch or a release from GitHub or the mirror, there is no Git version information, making setuptools-scm unable to read the version. The alternative way is to add a git archive file supported by setuptools-scm. See: * https://setuptools-scm.readthedocs.io/en/latest/usage/#git-archives (available in setuptools-scm 7.0.0) * https://git-scm.com/docs/git-archive#Documentation/git-archive.txt-export-subst * https://docs.github.com/en/repositories/working-with-files/using-files/downloading-source-code-archives Generated by the task: https://github.com/njzjz-bot/njzjz-bot/issues/4. --- .git_archival.txt | 4 ++++ .gitattributes | 1 + pyproject.toml | 20 ++++++++++---------- 3 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 .git_archival.txt diff --git a/.git_archival.txt b/.git_archival.txt new file mode 100644 index 000000000..8fb235d70 --- /dev/null +++ b/.git_archival.txt @@ -0,0 +1,4 @@ +node: $Format:%H$ +node-date: $Format:%cI$ +describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$ +ref-names: $Format:%D$ diff --git a/.gitattributes b/.gitattributes index df37fe7b9..6db853ec9 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,3 @@ *.H linguist-language=C++ *.C linguist-language=C++ +.git_archival.txt export-subst diff --git a/pyproject.toml b/pyproject.toml index ad1b7501c..a30ae4b27 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,10 @@ -[build-system] -requires = [ - "setuptools", - "setuptools_scm", - "wheel", - "scikit-build", - "cmake", - # see https://github.com/scikit-build/scikit-build/releases/tag/0.13.1 - "ninja; platform_system!='Windows'", -] +[build-system] +requires = [ + "setuptools", + "setuptools_scm", + "wheel", + "scikit-build", + "cmake", + # see https://github.com/scikit-build/scikit-build/releases/tag/0.13.1 + "ninja; platform_system!='Windows'", +]