lol

Merge pull request #261150 from Wulfsta/libfive

libfive: add python bindings

authored by

Peder Bergebakken Sundt and committed by
GitHub
ca8a2594 08818622

+36 -4
+29 -3
pkgs/development/libraries/libfive/default.nix
··· 10 10 , libpng 11 11 , boost 12 12 , guile 13 + , python 13 14 , qtbase 14 15 , darwin 15 16 }: ··· 25 26 hash = "sha256-OITy3fJx+Z6856V3D/KpSQRJztvOdJdqUv1c65wNgCc="; 26 27 }; 27 28 28 - nativeBuildInputs = [ wrapQtAppsHook cmake ninja pkg-config ]; 29 - buildInputs = [ eigen zlib libpng boost guile qtbase ] 29 + nativeBuildInputs = [ wrapQtAppsHook cmake ninja pkg-config python.pkgs.pythonImportsCheckHook ]; 30 + buildInputs = [ eigen zlib libpng boost guile python qtbase ] 30 31 ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk_11_0.frameworks.Cocoa ]; 31 32 32 33 preConfigure = '' ··· 42 43 --replace "LIBFIVE_STDLIB_DIR=$<TARGET_FILE_DIR:libfive-stdlib>" \ 43 44 "LIBFIVE_STDLIB_DIR=$out/lib" 44 45 46 + substituteInPlace libfive/bind/python/CMakeLists.txt \ 47 + --replace ' ''${PYTHON_SITE_PACKAGES_DIR}' \ 48 + " $out/${python.sitePackages}" \ 49 + 50 + substituteInPlace libfive/bind/python/libfive/ffi.py \ 51 + --replace "os.path.join('libfive', folder)" \ 52 + "os.path.join('$out/${python.sitePackages}/libfive', folder)" \ 53 + 45 54 export XDG_CACHE_HOME=$(mktemp -d)/.cache 46 55 ''; 47 56 ··· 63 72 '' + '' 64 73 # Link "Studio" binary to "libfive-studio" to be more obvious: 65 74 ln -s "$out/bin/Studio" "$out/bin/libfive-studio" 75 + 76 + # Create links since libfive looks for the library in a specific path. 77 + mkdir -p "$out/${python.sitePackages}/libfive/src" 78 + ln -s "$out"/lib/libfive.* "$out/${python.sitePackages}/libfive/src/" 79 + mkdir -p "$out/${python.sitePackages}/libfive/stdlib" 80 + ln -s "$out"/lib/libfive-stdlib.* "$out/${python.sitePackages}/libfive/stdlib/" 81 + 82 + # Create links so Studio can find the bindings. 83 + mkdir -p "$out/libfive/bind" 84 + ln -s "$out/${python.sitePackages}" "$out/libfive/bind/python" 66 85 ''; 67 86 87 + pythonImportsCheck = [ 88 + "libfive" 89 + "libfive.runner" 90 + "libfive.shape" 91 + "libfive.stdlib" 92 + ]; 93 + 68 94 meta = with lib; { 69 95 description = "Infrastructure for solid modeling with F-Reps in C, C++, and Guile"; 70 96 homepage = "https://libfive.com/"; 71 - maintainers = with maintainers; [ hodapp kovirobi ]; 97 + maintainers = with maintainers; [ hodapp kovirobi wulfsta ]; 72 98 license = with licenses; [ mpl20 gpl2Plus ]; 73 99 platforms = with platforms; all; 74 100 };
+3 -1
pkgs/top-level/all-packages.nix
··· 22873 22873 22874 22874 libfabric = callPackage ../development/libraries/libfabric { }; 22875 22875 22876 - libfive = qt6Packages.callPackage ../development/libraries/libfive { }; 22876 + libfive = qt6Packages.callPackage ../development/libraries/libfive { 22877 + python = python3; 22878 + }; 22877 22879 22878 22880 libfixposix = callPackage ../development/libraries/libfixposix { }; 22879 22881
+4
pkgs/top-level/python-packages.nix
··· 6150 6150 pythonSupport = true; 6151 6151 }); 6152 6152 6153 + libfive = toPythonModule (pkgs.libfive.override { 6154 + inherit python; 6155 + }); 6156 + 6153 6157 libgpiod = callPackage ../development/python-modules/libgpiod { 6154 6158 inherit (pkgs) libgpiod; 6155 6159 };