nixpkgs/pkgs/development/python-modules/sphinx-version-warning/default.nix
Peder Bergebakken Sundt 5aba99242e treewide: fix typos in comments
Made with

```shell
git restore .
fd '\.nix$' pkgs/ --type f -j1 -x bash -xc "$(cat <<"EOF"
    typos --no-check-filenames --write-changes "$1"
    git diff --exit-code "$1" && exit
    #( git diff "$1" | grep -qE "^\+ +[^# ]") && git restore "$1"
    count1="$( bat --language nix --diff --style changes "$1" --theme "Monokai Extended" --color always | aha --no-header | grep -E '^<span style="color:olive;">~</span> ' | wc -l )"
    count2="$( bat --language nix --diff --style changes "$1" --theme "Monokai Extended" --color always | aha --no-header | grep -E '^<span style="color:olive;">~</span> (<span style="color:#f8f8f2;"> *</span>)?<span style="color:#75715e;">.*</span>$' | wc -l )"
    [[ $count1 -ne $count2 ]] && git restore "$1"
EOF
)" -- {}
```

and filtered with `GIT_DIFF_OPTS='--unified=15' git -c interactive.singleKey=true add --patch`

I initially tried using the tree-sitter cli, python bindings and even ast-grep through various means, but this is what I ended up with.
2025-02-24 10:44:41 +01:00

69 lines
1.7 KiB
Nix

{
lib,
buildPythonPackage,
fetchFromGitHub,
fetchpatch,
pythonOlder,
setuptools,
sphinx,
sphinx-autoapi,
sphinx-prompt,
sphinx-rtd-theme,
sphinx-tabs,
sphinxemoji,
sphinxHook,
}:
# Latest tagged release release "1.1.2" (Nov 2018) does not contain
# documentation, it was added in commits Aug 10, 2019. Repository does not have
# any activity since then.
buildPythonPackage {
pname = "sphinx-version-warning";
version = "unstable-2019-08-10";
pyproject = true;
disabled = pythonOlder "3.7";
outputs = [
"out"
"doc"
];
src = fetchFromGitHub {
owner = "humitos";
repo = "sphinx-version-warning";
rev = "a82156c2ea08e5feab406514d0ccd9d48a345f48";
hash = "sha256-WnJYMk1gPLT0dBn7lmxVDNVkLYkDCgQOtM9fQ3kc6k0=";
};
# It tries to write to file relative to it own location at runtime
# and gets permission denied, since Nix store is immutable.
patches = [
(fetchpatch {
url = "https://github.com/humitos/sphinx-version-warning/commit/cb1b47becf2a0d3b2570ca9929f42f7d7e472b6f.patch";
hash = "sha256-Vj0QAHIBmc0VxE+TTmJePzvr5nc45Sn2qqM+C/pkgtM=";
})
];
nativeBuildInputs = [
sphinx-autoapi
sphinx-prompt
sphinx-rtd-theme
sphinx-tabs
sphinxemoji
sphinxHook
setuptools
];
buildInputs = [ sphinx ];
pythonImportsCheck = [ "versionwarning" ];
meta = with lib; {
description = "Sphinx extension to show a warning banner at the top of your documentation";
homepage = "https://github.com/humitos/sphinx-version-warning";
changelog = "https://github.com/humitos/sphinx-version-warning/blob/${version}/CHANGELOG.rst";
license = licenses.mit;
maintainers = with maintainers; [ kaction ];
};
}