From 4a88b31471a7e855823d5329b02c06aae10d0b50 Mon Sep 17 00:00:00 2001 From: adisbladis Date: Tue, 6 Feb 2024 19:41:46 +1300 Subject: [PATCH] Add compat hacks, make python version constraints a warning --- python.nix | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/python.nix b/python.nix index 6050ce8..1053054 100644 --- a/python.nix +++ b/python.nix @@ -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 ]; + }))