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 , pyproject-nix
, clang-tools , clang-tools
, gitlint , gitlint
, lib
}: }:
let let
python = python3.override { python = python3.override {
self = python; self = python;
packageOverrides = self: super: { packageOverrides = self: super: {
# HACK: Zephyr uses pypi to install non-Python deps
clang-format = clang-tools; clang-format = clang-tools;
inherit gitlint; 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"; requirements = zephyr-src + "/scripts/requirements.txt";
}; };
invalidConstraints = project.validators.validateVersionConstraints { inherit python; };
in in
assert project.validators.validateVersionConstraints { inherit python; } == { }; lib.warnIf
python.withPackages (project.renderers.withPackages { (invalidConstraints != { })
inherit python; "zephyr-pythonEnv: Found invalid Python constraints for: ${builtins.toJSON (lib.attrNames invalidConstraints)}"
extraPackages = ps: [ ps.west ]; (python.withPackages (project.renderers.withPackages {
}) inherit python;
extraPackages = ps: [ ps.west ];
}))