Add compat hacks, make python version constraints a warning

This commit is contained in:
adisbladis 2024-02-06 19:41:46 +13:00
parent 509e3da4d9
commit 4a88b31471
1 changed files with 14 additions and 5 deletions

View File

@ -3,14 +3,19 @@
, pyproject-nix
, clang-tools
, gitlint
, lib
}:
let
python = python3.override {
self = python;
packageOverrides = self: super: {
# HACK: Zephyr uses pypi to install non-Python deps
clang-format = clang-tools;
inherit gitlint;
# HACK: Older Zephyr depends on these missing dependencies
sphinxcontrib-svg2pdfconverter = super.sphinxcontrib-svg2pdfconverter or null;
};
};
@ -18,9 +23,13 @@ let
requirements = zephyr-src + "/scripts/requirements.txt";
};
invalidConstraints = project.validators.validateVersionConstraints { inherit python; };
in
assert project.validators.validateVersionConstraints { inherit python; } == { };
python.withPackages (project.renderers.withPackages {
inherit python;
extraPackages = ps: [ ps.west ];
})
lib.warnIf
(invalidConstraints != { })
"zephyr-pythonEnv: Found invalid Python constraints for: ${builtins.toJSON (lib.attrNames invalidConstraints)}"
(python.withPackages (project.renderers.withPackages {
inherit python;
extraPackages = ps: [ ps.west ];
}))