python312Packages.taco: fix build (#358929)

This commit is contained in:
Weijia Wang 2024-11-27 22:18:46 +01:00 committed by GitHub
commit 9a9f9a021e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,25 +1,44 @@
{ stdenv {
, lib stdenv,
, fetchgit lib,
, cmake fetchFromGitHub,
, llvmPackages cmake,
, enablePython ? false python3,
, python ? null llvmPackages,
enablePython ? false,
python ? python3,
}: }:
let pyEnv = python.withPackages (p: with p; [ numpy scipy ]); let
pyEnv = python.withPackages (
p: with p; [
numpy
scipy
distutils
]
);
in stdenv.mkDerivation rec { in
stdenv.mkDerivation (finalAttrs: {
pname = "taco"; pname = "taco";
version = "unstable-2022-08-02"; version = "unstable-2022-08-02";
src = fetchgit { src = fetchFromGitHub {
url = "https://github.com/tensor-compiler/${pname}.git"; owner = "tensor-compiler";
repo = "taco";
rev = "2b8ece4c230a5f0f0a74bc6f48e28edfb6c1c95e"; rev = "2b8ece4c230a5f0f0a74bc6f48e28edfb6c1c95e";
fetchSubmodules = true; fetchSubmodules = true;
hash = "sha256-PnBocyRLiLALuVS3Gkt/yJeslCMKyK4zdsBI8BFaTSg="; hash = "sha256-PnBocyRLiLALuVS3Gkt/yJeslCMKyK4zdsBI8BFaTSg=";
}; };
src-new-pybind11 = python.pkgs.pybind11.src;
postPatch = ''
rm -rf python_bindings/pybind11/*
cp -r ${finalAttrs.src-new-pybind11}/* python_bindings/pybind11
find python_bindings/pybind11 -exec chmod +w {} \;
'';
# Remove test cases from cmake build as they violate modern C++ expectations # Remove test cases from cmake build as they violate modern C++ expectations
patches = [ ./taco.patch ]; patches = [ ./taco.patch ];
@ -31,7 +50,7 @@ in stdenv.mkDerivation rec {
cmakeFlags = [ cmakeFlags = [
"-DOPENMP=ON" "-DOPENMP=ON"
] ++ lib.optional enablePython "-DPYTHON=ON" ; ] ++ lib.optional enablePython "-DPYTHON=ON";
postInstall = lib.strings.optionalString enablePython '' postInstall = lib.strings.optionalString enablePython ''
mkdir -p $out/${python.sitePackages} mkdir -p $out/${python.sitePackages}
@ -45,11 +64,11 @@ in stdenv.mkDerivation rec {
# However, the python module works flawlessly. # However, the python module works flawlessly.
dontFixup = enablePython; dontFixup = enablePython;
meta = with lib; { meta = {
description = "Computes sparse tensor expressions on CPUs and GPUs"; description = "Computes sparse tensor expressions on CPUs and GPUs";
mainProgram = "taco"; mainProgram = "taco";
license = licenses.mit; license = lib.licenses.mit;
homepage = "https://github.com/tensor-compiler/taco"; homepage = "https://github.com/tensor-compiler/taco";
maintainers = [ maintainers.sheepforce ]; maintainers = [ lib.maintainers.sheepforce ];
}; };
} })