From da6f8bee2ac7ae1a1b016f4a4562c1fb782a3038 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Wed, 24 Sep 2025 23:31:06 +0200 Subject: [PATCH] python3Packages.example-robot-data: depend on pkgs.example-robot-data instead of rebuild, use the new BUILD_STANDALONE_PYTHON_INTERFACE feature. this also allow to break the circular depency and use: example-robot-data -> pinocchio -> python3Packages.pinocchio -> python3Packages.example-robot-data --- .../by-name/ex/example-robot-data/package.nix | 16 +------ .../example-robot-data/default.nix | 43 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 9 ++-- 3 files changed, 48 insertions(+), 20 deletions(-) create mode 100644 pkgs/development/python-modules/example-robot-data/default.nix diff --git a/pkgs/by-name/ex/example-robot-data/package.nix b/pkgs/by-name/ex/example-robot-data/package.nix index ffe2af1be919..321503b0cafe 100644 --- a/pkgs/by-name/ex/example-robot-data/package.nix +++ b/pkgs/by-name/ex/example-robot-data/package.nix @@ -5,8 +5,6 @@ lib, jrl-cmakemodules, pkg-config, - pythonSupport ? false, - python3Packages, stdenv, }: @@ -32,25 +30,15 @@ stdenv.mkDerivation (finalAttrs: { cmake doxygen pkg-config - ] - ++ lib.optionals pythonSupport [ - python3Packages.python - python3Packages.pythonImportsCheckHook ]; propagatedBuildInputs = [ jrl-cmakemodules - ] - ++ lib.optionals pythonSupport [ python3Packages.pinocchio ]; + ]; - cmakeFlags = [ (lib.cmakeBool "BUILD_PYTHON_INTERFACE" pythonSupport) ]; + cmakeFlags = [ (lib.cmakeBool "BUILD_PYTHON_INTERFACE" false) ]; doCheck = true; - # The package expect to find an `example-robot-data/robots` folder somewhere - # either in install prefix or in the sources - # where it can find the meshes for unit tests - preCheck = "ln -s source ../../example-robot-data"; - pythonImportsCheck = [ "example_robot_data" ]; meta = with lib; { description = "Set of robot URDFs for benchmarking and developed examples"; diff --git a/pkgs/development/python-modules/example-robot-data/default.nix b/pkgs/development/python-modules/example-robot-data/default.nix new file mode 100644 index 000000000000..3a9bfc18b39d --- /dev/null +++ b/pkgs/development/python-modules/example-robot-data/default.nix @@ -0,0 +1,43 @@ +{ + lib, + + toPythonModule, + pythonImportsCheckHook, + + example-robot-data, + + python, + pinocchio, +}: +toPythonModule ( + example-robot-data.overrideAttrs (super: { + pname = "py-${super.pname}"; + + cmakeFlags = super.cmakeFlags ++ [ + (lib.cmakeBool "BUILD_PYTHON_INTERFACE" true) + (lib.cmakeBool "BUILD_STANDALONE_PYTHON_INTERFACE" true) + ]; + + nativeBuildInputs = super.nativeBuildInputs ++ [ + python + ]; + + propagatedBuildInputs = super.propagatedBuildInputs ++ [ + example-robot-data + pinocchio + ]; + + nativeCheckInputs = [ + pythonImportsCheckHook + ]; + + # The package expect to find an `example-robot-data/robots` folder somewhere + # either in install prefix or in the sources + # where it can find the meshes for unit tests + preCheck = '' + ln -s source ../../example-robot-data + ''; + + pythonImportsCheck = [ "example_robot_data" ]; + }) +) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 3b72dfba853f..39ee4ccf6217 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -4898,12 +4898,9 @@ self: super: with self; { ewmhlib = callPackage ../development/python-modules/ewmhlib { }; - example-robot-data = toPythonModule ( - pkgs.example-robot-data.override { - pythonSupport = true; - python3Packages = self; - } - ); + example-robot-data = callPackage ../development/python-modules/example-robot-data { + inherit (pkgs) example-robot-data; + }; exceptiongroup = callPackage ../development/python-modules/exceptiongroup { };