python3Packages.mmcv: fix on python 3.13

This commit is contained in:
Gaetan Lepage
2025-06-24 19:00:22 +02:00
parent f005289e12
commit d5a9a62406
@@ -48,10 +48,17 @@ buildPythonPackage rec {
hash = "sha256-NNF9sLJWV1q6uBE73LUW4UWwYm4TBMTBJjJkFArBmsc=";
};
postPatch = ''
substituteInPlace setup.py \
--replace-fail "cpu_use = 4" "cpu_use = $NIX_BUILD_CORES"
'';
postPatch =
# Fails in python >= 3.13
# exec(compile(f.read(), version_file, "exec")) does not populate the locals() namesp
# In python 3.13, the locals() dictionary in a function does not automatically update with
# changes made by exec().
# https://peps.python.org/pep-0558/
''
substituteInPlace setup.py \
--replace-fail "cpu_use = 4" "cpu_use = $NIX_BUILD_CORES" \
--replace-fail "return locals()['__version__']" "return '${version}'"
'';
nativeBuildInputs = [
ninja