python3.pkgs.protobuf: fix build after updating protobuf to 3.23.4 (#248231)
This commit is contained in:
parent
e092a2a48d
commit
c958dcee02
|
@ -96,6 +96,8 @@ let
|
||||||
protobuf = self;
|
protobuf = self;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inherit abseil-cpp;
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
|
|
|
@ -3,9 +3,11 @@
|
||||||
, fetchpatch
|
, fetchpatch
|
||||||
, isPyPy
|
, isPyPy
|
||||||
, lib
|
, lib
|
||||||
|
, numpy
|
||||||
, protobuf
|
, protobuf
|
||||||
, pytestCheckHook
|
, pytestCheckHook
|
||||||
, pythonAtLeast
|
, pythonAtLeast
|
||||||
|
, substituteAll
|
||||||
, tzdata
|
, tzdata
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
@ -32,6 +34,12 @@ buildPythonPackage {
|
||||||
extraPrefix = "";
|
extraPrefix = "";
|
||||||
hash = "sha256-a/12C6yIe1tEKjsMxcfDAQ4JHolA8CzkN7sNG8ZspPs=";
|
hash = "sha256-a/12C6yIe1tEKjsMxcfDAQ4JHolA8CzkN7sNG8ZspPs=";
|
||||||
})
|
})
|
||||||
|
] ++ lib.optionals (lib.versionAtLeast protobuf.version "3.22") [
|
||||||
|
# Replace the vendored abseil-cpp with nixpkgs'
|
||||||
|
(substituteAll {
|
||||||
|
src = ./use-nixpkgs-abseil-cpp.patch;
|
||||||
|
abseil_cpp_include_path = "${lib.getDev protobuf.abseil-cpp}/include";
|
||||||
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
prePatch = ''
|
prePatch = ''
|
||||||
|
@ -41,6 +49,19 @@ buildPythonPackage {
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# Remove the line in setup.py that forces compiling with C++14. Upstream's
|
||||||
|
# CMake build has been updated to support compiling with other versions of
|
||||||
|
# C++, but the Python build has not. Without this, we observe compile-time
|
||||||
|
# errors using GCC.
|
||||||
|
#
|
||||||
|
# Fedora appears to do the same, per this comment:
|
||||||
|
#
|
||||||
|
# https://github.com/protocolbuffers/protobuf/issues/12104#issuecomment-1542543967
|
||||||
|
#
|
||||||
|
postPatch = ''
|
||||||
|
sed -i "/extra_compile_args.append('-std=c++14')/d" setup.py
|
||||||
|
'';
|
||||||
|
|
||||||
nativeBuildInputs = lib.optional isPyPy tzdata;
|
nativeBuildInputs = lib.optional isPyPy tzdata;
|
||||||
|
|
||||||
buildInputs = [ protobuf ];
|
buildInputs = [ protobuf ];
|
||||||
|
@ -54,6 +75,8 @@ buildPythonPackage {
|
||||||
|
|
||||||
nativeCheckInputs = [
|
nativeCheckInputs = [
|
||||||
pytestCheckHook
|
pytestCheckHook
|
||||||
|
] ++ lib.optionals (lib.versionAtLeast protobuf.version "3.22") [
|
||||||
|
numpy
|
||||||
];
|
];
|
||||||
|
|
||||||
disabledTests = lib.optionals isPyPy [
|
disabledTests = lib.optionals isPyPy [
|
||||||
|
@ -66,6 +89,18 @@ buildPythonPackage {
|
||||||
"testStrictUtf8Check"
|
"testStrictUtf8Check"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
disabledTestPaths = lib.optionals (lib.versionAtLeast protobuf.version "3.23") [
|
||||||
|
# The following commit (I think) added some internal test logic for Google
|
||||||
|
# that broke generator_test.py. There is a new proto file that setup.py is
|
||||||
|
# not generating into a .py file. However, adding this breaks a bunch of
|
||||||
|
# conflict detection in descriptor_test.py that I don't understand. So let's
|
||||||
|
# just disable generator_test.py for now.
|
||||||
|
#
|
||||||
|
# https://github.com/protocolbuffers/protobuf/commit/5abab0f47e81ac085f0b2d17ec3b3a3b252a11f1
|
||||||
|
#
|
||||||
|
"google/protobuf/internal/generator_test.py"
|
||||||
|
];
|
||||||
|
|
||||||
pythonImportsCheck = [
|
pythonImportsCheck = [
|
||||||
"google.protobuf"
|
"google.protobuf"
|
||||||
"google.protobuf.internal._api_implementation" # Verify that --cpp_implementation worked
|
"google.protobuf.internal._api_implementation" # Verify that --cpp_implementation worked
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
diff --git a/setup.py b/setup.py
|
||||||
|
index e65631013..d511c2996 100755
|
||||||
|
--- a/setup.py
|
||||||
|
+++ b/setup.py
|
||||||
|
@@ -412,7 +412,7 @@ if __name__ == '__main__':
|
||||||
|
Extension(
|
||||||
|
'google.protobuf.pyext._message',
|
||||||
|
glob.glob('google/protobuf/pyext/*.cc'),
|
||||||
|
- include_dirs=['.', '../src', '../third_party/abseil-cpp'],
|
||||||
|
+ include_dirs=['.', '../src', '@abseil_cpp_include_path@'],
|
||||||
|
libraries=libraries,
|
||||||
|
extra_objects=extra_objects,
|
||||||
|
extra_link_args=message_extra_link_args,
|
Loading…
Reference in a new issue