1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 setuptools,
6 sphinx,
7 gitpython,
8 gitMinimal,
9 pytestCheckHook,
10 sphinx-pytest,
11 pytest-cov-stub,
12}:
13buildPythonPackage rec {
14 pname = "sphinx-last-updated-by-git";
15 version = "0.3.8-unstable-2025-08-26";
16 pyproject = true;
17
18 src = fetchFromGitHub {
19 owner = "mgeier";
20 repo = "sphinx-last-updated-by-git";
21 rev = "07ac1a98af2a927e773a65c6524ce83067c977b8";
22 hash = "sha256-2TGFR11Ejh/9zpVC/TEdmMNaBt38wE5yeJeYixZSVUE=";
23 fetchSubmodules = true;
24 leaveDotGit = true;
25 };
26
27 build-system = [ setuptools ];
28
29 dependencies = [
30 sphinx
31 gitpython
32 ];
33
34 postPatch = ''
35 # we cant just substitute by matching `'git'` due to collisons
36 substituteInPlace src/sphinx_last_updated_by_git.py \
37 --replace-fail "'git', 'ls-tree'" " '${lib.getExe gitMinimal}', 'ls-tree'" \
38 --replace-fail "'git', 'log'" "'${lib.getExe gitMinimal}', 'log'" \
39 --replace-fail "'git', 'rev-parse'" "'${lib.getExe gitMinimal}', 'rev-parse'" \
40 '';
41
42 propagatedBuildInputs = [ gitMinimal ];
43
44 nativeCheckInputs = [
45 pytestCheckHook
46 sphinx-pytest
47 pytest-cov-stub
48 ];
49
50 disabledTests = [
51 "test_no_git" # we hardcoded the git path
52
53 "test_repo_shallow"
54 "test_repo_shallow_without_warning"
55 ];
56
57 meta = {
58 changelog = "https://github.com/mgeier/sphinx-last-updated-by-git/blob/${version}/NEWS.rst";
59 description = "Get the last updated time for each Sphinx page from Git";
60 homepage = "https://github.com/mgeier/sphinx-last-updated-by-git";
61 license = lib.licenses.bsd2;
62 maintainers = with lib.maintainers; [ sigmanificient ];
63 };
64}