From c8ece5516e7e0734842039913fa404ea0836f69b Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Sun, 2 Apr 2023 21:30:33 +0200 Subject: [PATCH] python310Packages.cython: Force regeneration of generated code in sdists Lots of python packages seem to ship their source distributions with generated code. In recent cython versions there is a way to force a regeneration of these files and using it sounds generally sounds like a good thing. If it turns out, that this causes problems on individual packages, setting `dontForceRegenCython` will prevent the regeneration. Added in 3.0.0a11 and backported to 2.9.34, so both cython versions we ship right now support this flag. --- pkgs/development/python-modules/Cython/default.nix | 4 ++++ pkgs/development/python-modules/Cython/setup-hook.sh | 3 +++ 2 files changed, 7 insertions(+) create mode 100644 pkgs/development/python-modules/Cython/setup-hook.sh diff --git a/pkgs/development/python-modules/Cython/default.nix b/pkgs/development/python-modules/Cython/default.nix index f4e8c927ad88..4f4cfea37c34 100644 --- a/pkgs/development/python-modules/Cython/default.nix +++ b/pkgs/development/python-modules/Cython/default.nix @@ -74,6 +74,10 @@ in buildPythonPackage rec { doCheck = false; # doCheck = !stdenv.isDarwin; + # force regeneration of generated code in source distributions + # https://github.com/cython/cython/issues/5089 + setupHook = ./setup-hook.sh; + meta = { changelog = "https://github.com/cython/cython/blob/${version}/CHANGES.rst"; description = "An optimising static compiler for both the Python programming language and the extended Cython programming language"; diff --git a/pkgs/development/python-modules/Cython/setup-hook.sh b/pkgs/development/python-modules/Cython/setup-hook.sh new file mode 100644 index 000000000000..c26330a53644 --- /dev/null +++ b/pkgs/development/python-modules/Cython/setup-hook.sh @@ -0,0 +1,3 @@ +if [ -z "${dontForceRegenCython-}"]; then + export CYTHON_FORCE_REGEN=1 +fi