python312Packages.torch: don't include .cmake files in $out

One of the files includes a reference to apple-sdk. This patch reduces
the size of the closure on darwin from ~1.5G to ~400M.

Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>
This commit is contained in:
Ihar Hrachyshka
2025-04-01 21:23:54 -04:00
parent 5cf6dda897
commit 7dab91f9e3
@@ -587,8 +587,15 @@ buildPythonPackage rec {
find "$out/${python.sitePackages}/torch/include" "$out/${python.sitePackages}/torch/lib" -type f -exec remove-references-to -t ${stdenv.cc} '{}' +
mkdir $dev
# CppExtension requires that include files are packaged with the main
# python library output; which is why they are copied here.
cp -r $out/${python.sitePackages}/torch/include $dev/include
cp -r $out/${python.sitePackages}/torch/share $dev/share
# Cmake files under /share are different and can be safely moved. This
# avoids unnecessary closure blow-up due to apple sdk references when
# USE_DISTRIBUTED is enabled.
mv $out/${python.sitePackages}/torch/share $dev/share
# Fix up library paths for split outputs
substituteInPlace \