From ee35aa18eb1c762532fbaaf44dea172b521089cc Mon Sep 17 00:00:00 2001 From: kfollesdal Date: Thu, 18 Jul 2024 20:41:34 +0200 Subject: [PATCH 1/2] python3Packages.thrift: Enable package for python 3.12 --- pkgs/development/python-modules/thrift/default.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/thrift/default.nix b/pkgs/development/python-modules/thrift/default.nix index f33ba9cfa2f64..19b685b3f8eb2 100644 --- a/pkgs/development/python-modules/thrift/default.nix +++ b/pkgs/development/python-modules/thrift/default.nix @@ -2,7 +2,6 @@ lib, buildPythonPackage, fetchPypi, - pythonAtLeast, pythonOlder, setuptools, six, @@ -14,7 +13,7 @@ buildPythonPackage rec { pyproject = true; # Still uses distutils - disabled = pythonOlder "3.7" || pythonAtLeast "3.12"; + disabled = pythonOlder "3.7"; src = fetchPypi { inherit pname version; From 96f673e54cf4d67fb7f3f605a22924f8bdb6430f Mon Sep 17 00:00:00 2001 From: kfollesdal Date: Thu, 18 Jul 2024 20:42:07 +0200 Subject: [PATCH 2/2] python3Package.thrift: Fix for python 3.12 support --- pkgs/development/python-modules/thrift/default.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkgs/development/python-modules/thrift/default.nix b/pkgs/development/python-modules/thrift/default.nix index 19b685b3f8eb2..f76256058abab 100644 --- a/pkgs/development/python-modules/thrift/default.nix +++ b/pkgs/development/python-modules/thrift/default.nix @@ -5,6 +5,7 @@ pythonOlder, setuptools, six, + python, }: buildPythonPackage rec { @@ -20,6 +21,18 @@ buildPythonPackage rec { hash = "sha256-TdZi6t9riuvopBcpUnvWmt9s6qKoaBy+9k0Sc7Po/ro="; }; + preBuild = '' + # Fix so distutils is available in build prosess. + # Function setuptools/_distutils/util.py:byte_compile is used in build prosess + # but setuptools distutils import trick/hack is not working in build prosses + # and we get ModuleNotfoundError 'No module named 'distutils' + # For more explanation see first attempt: + # https://github.com/NixOS/nixpkgs/pull/328182 + DISTUTILS=$(mktemp -d) + ln -s ${setuptools}/${python.sitePackages}/setuptools/_distutils "$DISTUTILS/distutils" + PYTHONPATH="$PYTHONPATH:$DISTUTILS" + ''; + build-system = [ setuptools ]; dependencies = [ six ];