From 7aa811cb0bc19b19109384ba14819d3e9a1254e4 Mon Sep 17 00:00:00 2001 From: Igor Brylyov Date: Mon, 22 Apr 2024 15:51:35 +0300 Subject: [PATCH] init: freecad-py 21.2.0, bpy overlayed version --- flake.nix | 24 +++++++++++-------- .../freecad.robossembler/default.nix | 19 +++++++++++---- .../python-modules/rcg-pipeline/default.nix | 7 ++++-- pkgs/misc/bpy-lib/default.nix | 14 +++++++++++ pkgs/misc/freecad-lib/default.nix | 14 +++++++++++ 5 files changed, 61 insertions(+), 17 deletions(-) create mode 100644 pkgs/misc/bpy-lib/default.nix create mode 100644 pkgs/misc/freecad-lib/default.nix diff --git a/flake.nix b/flake.nix index 15ac36c..ba62d22 100644 --- a/flake.nix +++ b/flake.nix @@ -32,7 +32,7 @@ pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [ ( python-final: python-prev: { - iopath = python-prev.iopath.overridePythonAttrs (oldAttrs: { + iopath = python-prev.iopath.overridePythonAttrs (oldAttrs: { version = "unstable"; src = pkgs.fetchFromGitHub { owner = "facebookresearch"; @@ -110,14 +110,11 @@ "-DWITH_INSTALL_PORTABLE=ON" ]; postInstall = '' - mkdir -p $out/lib/python${pkgs.python3.pythonVersion}/site-packages mkdir -p $out/nix-support - mv $out/bpy $out/lib/python${pkgs.python3.pythonVersion}/site-packages/ + mkdir -p $out/lib/python${pkgs.python3.pythonVersion}/site-packages + ln -s $out/bpy $out/lib/python${pkgs.python3.pythonVersion}/site-packages/bpy echo ${pkgs.python3} >> $out/nix-support/propagated-build-inputs ''; - postFixup = '' - buildPythonPath $out/lib/python${pkgs.python3.pythonVersion}/site-packages - ''; }); bpy-wheel = pkgs.python3Packages.callPackage ./pkgs/development/python-modules/bpy-wheel { }; pysdf = pkgs.python3Packages.callPackage ./pkgs/development/python-modules/pysdf { }; @@ -132,8 +129,10 @@ ansitable = pkgs.python3Packages.callPackage ./pkgs/development/python-modules/ansitable { }; megapose6d = pkgs.python3Packages.callPackage ./pkgs/development/python-modules/megapose6d { inherit webdataset; }; spatialmath = pkgs.python3Packages.callPackage ./pkgs/development/python-modules/spatialmath { inherit ansitable; }; - rcg-pipeline = pkgs.python3Packages.callPackage ./pkgs/development/python-modules/rcg-pipeline { inherit bpy-wheel; }; - rbs-workbench = pkgs.python3Packages.callPackage ./pkgs/development/python-modules/freecad.robossembler { }; + rcg-pipeline = pkgs.python3Packages.callPackage ./pkgs/development/python-modules/rcg-pipeline { bpy = bpy-lib; }; + rbs-workbench = pkgs.python3Packages.callPackage ./pkgs/development/python-modules/freecad.robossembler { inherit freecad-py; }; + freecad-py = pkgs.python3Packages.toPythonModule (pkgs.callPackage ./pkgs/misc/freecad-lib { }); + bpy-lib = pkgs.python3Packages.toPythonModule bpy; in { inherit pkgs; @@ -146,7 +145,7 @@ }; packages = { - inherit mayo pysdf fstl unified-planning test-script blender bpy bpy-wheel rcg-pipeline; + inherit mayo pysdf fstl unified-planning test-script blender bpy bpy-wheel rcg-pipeline freecad-py bpy-lib; }; devShells.ci = pkgs.mkShell { buildInputs = [ pkgs.jq ]; }; @@ -217,10 +216,15 @@ spatialmath rcg-pipeline rbs-workbench + ledger ]; in pkgs.mkShell { - packages = [ (pkgs.python3.withPackages my-python-packages) pkgs.freecad mayo pkgs.bashInteractive ]; + packages = with pkgs; [ + freecad + mayo + bashInteractive + ] ++ [ (pkgs.python3.withPackages my-python-packages) ]; buildInputs = [ ]; # Run when the shell is started up diff --git a/pkgs/development/python-modules/freecad.robossembler/default.nix b/pkgs/development/python-modules/freecad.robossembler/default.nix index 95b721d..4033eac 100644 --- a/pkgs/development/python-modules/freecad.robossembler/default.nix +++ b/pkgs/development/python-modules/freecad.robossembler/default.nix @@ -6,17 +6,21 @@ , pythonImportsCheckHook , config , setuptools +, freecad-py +, pytestCheckHook +, toPythonModule +, python , ... }: buildPythonPackage rec { - name = "rbs-workbench"; + name = "freecad.robossembler"; version = "1.0.0"; format = "setuptools"; src = fetchgit { url = "https://gitlab.com/robossembler/framework"; - hash = "sha256-N9xFVU4+GbuRR5saMkK7GjKPqKjk2LjcTFWqVhhJ0bs="; - rev = "946e83fd159f9ed234b70923df657bc5120cc62f"; + hash = "sha256-K6vnCQn129TWiMEKe81eBx/1H6PaIriCnkHGRwL8fg0="; + rev = "e8bb59124d56c5aee0180b4c7d5c7bfeec9cb1ea"; }; sourceRoot = "${src.name}/freecad_workbench"; @@ -24,11 +28,16 @@ buildPythonPackage rec { setuptools ]; - propagatedBuildInputs = [ - ]; + buildInputs = [ freecad-py ]; + propagatedBuildInputs = [ + freecad-py + ]; + pythonImportsCheck = [ "freecad.robossembler" ]; + doCheck = false; + meta = with lib; { description = "Robossembler CG Pipeline Python Module"; homepage = "https://gitlab.com/robossembler/framework/rcg_pipeline"; diff --git a/pkgs/development/python-modules/rcg-pipeline/default.nix b/pkgs/development/python-modules/rcg-pipeline/default.nix index 22c4134..3c3de0e 100644 --- a/pkgs/development/python-modules/rcg-pipeline/default.nix +++ b/pkgs/development/python-modules/rcg-pipeline/default.nix @@ -8,7 +8,7 @@ , cudaSupport ? config.cudaSupport , numpy , setuptools -, bpy-wheel +, bpy , ... }: buildPythonPackage rec { @@ -29,9 +29,12 @@ buildPythonPackage rec { propagatedBuildInputs = [ numpy - bpy-wheel + bpy ]; + # TODO - see later, pyproject.toml duntime deps check doesnt work + dontCheckRuntimeDeps = true; + pythonImportsCheck = [ "rcg_pipeline" ]; meta = with lib; { diff --git a/pkgs/misc/bpy-lib/default.nix b/pkgs/misc/bpy-lib/default.nix new file mode 100644 index 0000000..239f58f --- /dev/null +++ b/pkgs/misc/bpy-lib/default.nix @@ -0,0 +1,14 @@ +{ stdenv +, bpy +, python3 +}: +stdenv.mkDerivation { + inherit (bpy) version; + pname = "bpy-lib"; + src = bpy; + buildInputs = [ python3 ]; + installPhase = '' + mkdir -p $out/lib/python${python3.pythonVersion} + ln -s ${bpy}/bpy $out/lib/python${python3.pythonVersion}/site-packages + ''; +} diff --git a/pkgs/misc/freecad-lib/default.nix b/pkgs/misc/freecad-lib/default.nix new file mode 100644 index 0000000..cec2b44 --- /dev/null +++ b/pkgs/misc/freecad-lib/default.nix @@ -0,0 +1,14 @@ +{ stdenv +, freecad +, python3 +}: +stdenv.mkDerivation { + inherit (freecad) version; + pname = "freecad-lib"; + src = freecad; + buildInputs = [ python3 ]; + installPhase = '' + mkdir -p $out/lib/python${python3.pythonVersion} + ln -s ${freecad}/lib $out/lib/python${python3.pythonVersion}/site-packages + ''; +}