python3Packages.netaddr: fix static build (#441076)

This commit is contained in:
Gergő Gutyina
2025-12-15 09:59:02 +00:00
committed by GitHub
@@ -1,8 +1,8 @@
{
lib,
stdenv,
buildPythonPackage,
fetchPypi,
pythonOlder,
setuptools,
pytestCheckHook,
}:
@@ -12,14 +12,24 @@ buildPythonPackage rec {
version = "1.3.0";
pyproject = true;
disabled = pythonOlder "3.7";
src = fetchPypi {
inherit pname version;
hash = "sha256-XDw9mJW1Ubdjd5un23oDSH3B+OOzha+BmvNBrp725Io=";
};
nativeBuildInputs = [ setuptools ];
# Test suite uses internal packaging._musllinux module to detect libc flavor. The module assumes
# the python executable is dynamically linked - it then attempts to parse linked library name to
# detect musl. It won't work on a static build.
postPatch =
if (stdenv.targetPlatform.isMusl && stdenv.targetPlatform.isStatic) then
''
substituteInPlace netaddr/tests/__init__.py \
--replace-fail "IS_MUSL = _get_musl_version(sys.executable) is not None" "IS_MUSL = True"
''
else
null;
build-system = [ setuptools ];
nativeCheckInputs = [ pytestCheckHook ];