From 9eb9a9904c00bcae2760abd8038c2c6e2088769d Mon Sep 17 00:00:00 2001 From: Ben Wolsieffer Date: Tue, 17 May 2022 19:26:20 -0400 Subject: [PATCH] python3Packages.setuptools: add distutils patch to support cross-compilation This is mostly the same patch applied to stdlib distutils, except rebased and reworked a bit. This fixes cross-compilation of Python packages with C extension modules now that setuptools uses bundled distutils. (cherry picked from commit 2294dace6ae30d095719a6dd8413242ec61ca8e5) --- pkgs/development/python-modules/setuptools/default.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/development/python-modules/setuptools/default.nix b/pkgs/development/python-modules/setuptools/default.nix index 1d9592022d16f..772d9c79c2b11 100644 --- a/pkgs/development/python-modules/setuptools/default.nix +++ b/pkgs/development/python-modules/setuptools/default.nix @@ -1,6 +1,7 @@ { stdenv , buildPythonPackage , fetchFromGitHub +, fetchpatch , python , bootstrapped-pip , lib @@ -27,6 +28,14 @@ let patches = [ ./tag-date.patch ./setuptools-distutils-C++.patch + # Use sysconfigdata to find headers. Fixes cross-compilation of extension modules. + # https://github.com/pypa/distutils/pull/145 + (fetchpatch { + url = "https://github.com/pypa/distutils/commit/aed7294b7b0c228cc0666a8b04f2959bf310ab57.patch"; + hash = "sha256-/9+TKv0nllBfnj48zcXLrOgyBj52dBIVbrpnIaQ4O84="; + stripLen = 2; + extraPrefix = "setuptools/_distutils/"; + }) ]; buildPhase = ''