mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-08-25 17:55:21 +00:00
pre-commit-hooks: fix conditional dependency on tomli (#200178)
* pre-commit-hooks: fix conditional dependency on tomli
As seen in fc88f3fa49, upstream changed their dependency from `toml` to `tomli>=1.1.0;python_version<"3.11"`.
Without this patch, running `check-toml` from this package fails with:
```
Traceback (most recent call last):
File "/nix/store/06qpfmlgkhxakgjs8g7gk5jlkczij0m6-python3.10-pre-commit-hooks-4.3.0/bin/.check-toml-wrapped", line 6, in <module>
from pre_commit_hooks.check_toml import main
File "/nix/store/06qpfmlgkhxakgjs8g7gk5jlkczij0m6-python3.10-pre-commit-hooks-4.3.0/lib/python3.10/site-packages/pre_commit_hooks/check_toml.py", line 10, in <module>
import tomli as tomllib
ModuleNotFoundError: No module named 'tomli'
```
See https://github.com/pre-commit/pre-commit-hooks/issues/833.
* pre-commit-hooks: use lib.optionals helper for clarity
Co-authored-by: Fabian Affolter <mail@fabian-affolter.ch>
Co-authored-by: Fabian Affolter <mail@fabian-affolter.ch>
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
, pytestCheckHook
|
||||
, pythonOlder
|
||||
, ruamel-yaml
|
||||
, toml
|
||||
, tomli
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
@@ -25,7 +25,8 @@ buildPythonPackage rec {
|
||||
|
||||
propagatedBuildInputs = [
|
||||
ruamel-yaml
|
||||
toml
|
||||
] ++ lib.optionals (pythonOlder "3.11") [
|
||||
tomli
|
||||
];
|
||||
|
||||
checkInputs = [
|
||||
|
||||
Reference in New Issue
Block a user