Resolve "Упаковать FreeCAD / freecadcmd" #29

Merged
movefasta merged 4 commits from 4-freecad-workbench-module into master 2024-04-22 18:59:25 +03:00
5 changed files with 102 additions and 17 deletions

View file

@ -22,6 +22,13 @@
# pkgs = nixpkgs.legacyPackages.${system}.extend overlay;
ros = ros-flake.legacyPackages.${system};
# single source for Robossembler Framework packages
rbsFrameworkSrc = pkgs.fetchgit {
url = "https://gitlab.com/robossembler/framework";
hash = "sha256-K6vnCQn129TWiMEKe81eBx/1H6PaIriCnkHGRwL8fg0=";
rev = "e8bb59124d56c5aee0180b4c7d5c7bfeec9cb1ea";
};
pkgs = import nixpkgs { inherit system; overlays = [ overlay gazebo.overlays.default ]; };
overlay = final: prev: {
@ -32,7 +39,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 +117,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,7 +136,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; };
rcg-pipeline = pkgs.python3Packages.callPackage ./pkgs/development/python-modules/rcg-pipeline { bpy = bpy-lib; inherit rbsFrameworkSrc; };
rbs-workbench = pkgs.python3Packages.callPackage ./pkgs/development/python-modules/freecad.robossembler { inherit freecad-py; inherit rbsFrameworkSrc; };
freecad-py = pkgs.python3Packages.toPythonModule (pkgs.callPackage ./pkgs/misc/freecad-lib { });
bpy-lib = pkgs.python3Packages.toPythonModule bpy;
in
{
inherit pkgs;
@ -145,7 +152,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 ]; };
@ -215,10 +222,16 @@
scipy
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

View file

@ -0,0 +1,45 @@
{ buildPythonPackage
, fetchgit
, python3Packages
, lib
, autoPatchelfHook
, pythonImportsCheckHook
, config
, setuptools
, freecad-py
, pytestCheckHook
, toPythonModule
, python
, rbsFrameworkSrc
, ... }:
buildPythonPackage rec {
name = "freecad.robossembler";
version = "1.0.0";
format = "setuptools";
src = rbsFrameworkSrc;
sourceRoot = "${src.name}/freecad_workbench";
nativeBuildInputs = [
setuptools
];
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";
license = licenses.mit;
maintainers = with maintainers; [ ];
};
}

View file

@ -8,7 +8,8 @@
, cudaSupport ? config.cudaSupport
, numpy
, setuptools
, bpy-wheel
, bpy
, rbsFrameworkSrc
, ... }:
buildPythonPackage rec {
@ -16,13 +17,8 @@ buildPythonPackage rec {
version = "1.0.0";
format = "pyproject";
# src = /home/movefasta/Documents/robossembler/framework;
src = rbsFrameworkSrc;
src = fetchgit {
url = "https://gitlab.com/robossembler/framework";
hash = "sha256-iLPphGbIGf7IRdedBSC2yJ2M3ttsHATvtOLot/04AZU=";
rev = "8268db0dec793bfa42d4fcba24c7d442938b7a25";
};
sourceRoot = "${src.name}/rcg_pipeline";
nativeBuildInputs = [
@ -31,9 +27,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; {

View file

@ -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
'';
}

View file

@ -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
'';
}