Merge pull request #177249 from dotlambda/rapidjson-tests

rapidjson: run tests

authored by Rick van Schijndel and committed by GitHub abb346a4 7c0bac48

+68 -18
+34 -5
pkgs/development/libraries/rapidjson/default.nix
··· 1 - { stdenv, lib, fetchFromGitHub, fetchpatch, pkg-config, cmake }: 1 + { lib 2 + , stdenv 3 + , fetchFromGitHub 4 + , fetchpatch 5 + , pkg-config 6 + , cmake 7 + , gtest 8 + }: 2 9 3 10 stdenv.mkDerivation rec { 4 11 pname = "rapidjson"; ··· 16 23 url = "https://src.fedoraproject.org/rpms/rapidjson/raw/48402da9f19d060ffcd40bf2b2e6987212c58b0c/f/rapidjson-1.1.0-c++20.patch"; 17 24 sha256 = "1qm62iad1xfsixv1li7qy475xc7gc04hmi2q21qdk6l69gk7mf82"; 18 25 }) 26 + (fetchpatch { 27 + url = "https://git.alpinelinux.org/aports/plain/community/rapidjson/do-not-include-gtest-src-dir.patch"; 28 + hash = "sha256-BjSZEwfCXA/9V+kxQ/2JPWbc26jQn35CfN8+8NW24s4="; 29 + }) 19 30 ]; 20 31 32 + postPatch = '' 33 + find -name CMakeLists.txt | xargs \ 34 + sed -i -e "s/-Werror//g" -e "s/-march=native//g" 35 + ''; 36 + 21 37 nativeBuildInputs = [ pkg-config cmake ]; 22 38 23 - preConfigure = '' 24 - substituteInPlace CMakeLists.txt --replace "-Werror" "" 25 - substituteInPlace example/CMakeLists.txt --replace "-Werror" "" 39 + cmakeFlags = [ 40 + "-DGTEST_SOURCE_DIR=${gtest.dev}/include" 41 + ]; 42 + 43 + checkInputs = [ 44 + gtest 45 + ]; 46 + 47 + checkPhase = '' 48 + runHook preCheck 49 + 50 + ctest -E '.*valgrind.*' 51 + 52 + runHook postCheck 26 53 ''; 54 + 55 + doCheck = true; 27 56 28 57 meta = with lib; { 29 58 description = "Fast JSON parser/generator for C++ with both SAX/DOM style API"; 30 59 homepage = "http://rapidjson.org/"; 31 60 license = licenses.mit; 32 61 platforms = platforms.unix; 33 - maintainers = with maintainers; [ cstrahan ]; 62 + maintainers = with maintainers; [ cstrahan dotlambda ]; 34 63 }; 35 64 }
+34 -13
pkgs/development/python-modules/python-rapidjson/default.nix
··· 1 1 { lib 2 2 , buildPythonPackage 3 + , fetchFromGitHub 4 + , fetchpatch 3 5 , fetchPypi 4 6 , pythonOlder 5 - , pytest 7 + , rapidjson 8 + , pytestCheckHook 6 9 , pytz 7 10 , glibcLocales 8 11 }: 9 12 10 - buildPythonPackage rec { 13 + let 14 + rapidjson' = rapidjson.overrideAttrs (old: { 15 + version = "unstable-2022-05-24"; 16 + src = fetchFromGitHub { 17 + owner = "Tencent"; 18 + repo = "rapidjson"; 19 + rev = "232389d4f1012dddec4ef84861face2d2ba85709"; 20 + hash = "sha256-RLvDcInUa8E8DRA4U/oXEE8+TZ0SDXXDU/oWvpfDWjw="; 21 + }; 22 + patches = [ 23 + (fetchpatch { 24 + url = "https://git.alpinelinux.org/aports/plain/community/rapidjson/do-not-include-gtest-src-dir.patch"; 25 + hash = "sha256-BjSZEwfCXA/9V+kxQ/2JPWbc26jQn35CfN8+8NW24s4="; 26 + }) 27 + ]; 28 + }); 29 + in buildPythonPackage rec { 11 30 version = "1.6"; 12 31 pname = "python-rapidjson"; 13 - disabled = pythonOlder "3.4"; 32 + disabled = pythonOlder "3.7"; 14 33 15 34 src = fetchPypi { 16 35 inherit pname version; 17 36 sha256 = "sha256-GJzxqWv5/NhtADYPFa12qDzgiJuK6NHLD9srKZXlocg="; 18 37 }; 19 38 20 - LC_ALL="en_US.utf-8"; 21 - buildInputs = [ glibcLocales ]; 39 + setupPyBuildFlags = [ 40 + "--rj-include-dir=${lib.getDev rapidjson'}/include" 41 + ]; 22 42 23 - # buildInputs = [ ]; 24 - checkInputs = [ pytest pytz ]; 25 - # propagatedBuildInputs = [ ]; 43 + checkInputs = [ 44 + pytestCheckHook 45 + pytz 46 + ]; 26 47 27 - checkPhase = '' 28 - pytest tests 29 - ''; 48 + disabledTestPaths = [ 49 + "benchmarks" 50 + ]; 30 51 31 52 meta = with lib; { 32 53 homepage = "https://github.com/python-rapidjson/python-rapidjson"; 33 - description = "Python wrapper around rapidjson "; 54 + description = "Python wrapper around rapidjson"; 34 55 license = licenses.mit; 35 - maintainers = [ maintainers.costrouc ]; 56 + maintainers = with maintainers; [ costrouc dotlambda ]; 36 57 }; 37 58 }