From b13eda15a5eebd1965c00ebc7d32649e890380dc Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Thu, 12 Feb 2026 16:45:56 -0500 Subject: [PATCH] [REL] Add git archival support for setuptools-scm (#1609) * Add git archival support * Add a comment about export-subst (cherry picked from commit 3e022addbb47e7982d5e25d77bb9d8710ab410bc) --- .git_archival.txt | 3 +++ .gitattributes | 11 +++++++++-- .pre-commit-config.yaml | 1 + cuda_bindings/.git_archival.txt | 1 + cuda_core/.git_archival.txt | 1 + cuda_pathfinder/.git_archival.txt | 1 + cuda_python_test_helpers/.git_archival.txt | 1 + 7 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 .git_archival.txt create mode 120000 cuda_bindings/.git_archival.txt create mode 120000 cuda_core/.git_archival.txt create mode 120000 cuda_pathfinder/.git_archival.txt create mode 120000 cuda_python_test_helpers/.git_archival.txt diff --git a/.git_archival.txt b/.git_archival.txt new file mode 100644 index 0000000000..b651b9d07d --- /dev/null +++ b/.git_archival.txt @@ -0,0 +1,3 @@ +node: $Format:%H$ +node-date: $Format:%cI$ +ref-names: $Format:%D$ diff --git a/.gitattributes b/.gitattributes index aeb320061b..0403e15307 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,3 @@ -cuda/_version.py export-subst - * text eol=lf # we do not own any headers checked in, don't touch them @@ -7,3 +5,12 @@ cuda/_version.py export-subst *.hpp binary # git should not convert line endings in PNG files *.png binary +*.svg binary +# SCM syntax highlighting & preventing 3-way merges +pixi.lock merge=binary linguist-language=YAML linguist-generated=true + +# "export-subst" specifies that this file will get filled in with the current +# commit and tag information when running `git archive`. This allows +# `setuptools-scm` to correctly determine the version when building from a git +# archive. See #1609. +.git_archival.txt export-subst diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8821c46cc0..bdfd9a427d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -31,6 +31,7 @@ repos: language: python additional_dependencies: - https://files.pythonhosted.org/packages/cc/20/ff623b09d963f88bfde16306a54e12ee5ea43e9b597108672ff3a408aad6/pathspec-0.12.1-py3-none-any.whl + exclude: '(.*pixi\.lock)|(\.git_archival\.txt)' - repo: https://github.com/PyCQA/bandit rev: 2d0b675b04c80ae42277e10500db06a0a37bae17 # frozen: 1.8.6 diff --git a/cuda_bindings/.git_archival.txt b/cuda_bindings/.git_archival.txt new file mode 120000 index 0000000000..d7a42b253d --- /dev/null +++ b/cuda_bindings/.git_archival.txt @@ -0,0 +1 @@ +../.git_archival.txt \ No newline at end of file diff --git a/cuda_core/.git_archival.txt b/cuda_core/.git_archival.txt new file mode 120000 index 0000000000..d7a42b253d --- /dev/null +++ b/cuda_core/.git_archival.txt @@ -0,0 +1 @@ +../.git_archival.txt \ No newline at end of file diff --git a/cuda_pathfinder/.git_archival.txt b/cuda_pathfinder/.git_archival.txt new file mode 120000 index 0000000000..d7a42b253d --- /dev/null +++ b/cuda_pathfinder/.git_archival.txt @@ -0,0 +1 @@ +../.git_archival.txt \ No newline at end of file diff --git a/cuda_python_test_helpers/.git_archival.txt b/cuda_python_test_helpers/.git_archival.txt new file mode 120000 index 0000000000..d7a42b253d --- /dev/null +++ b/cuda_python_test_helpers/.git_archival.txt @@ -0,0 +1 @@ +../.git_archival.txt \ No newline at end of file