1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 cython, 6 setuptools, 7 pytestCheckHook, 8 fetchpatch, 9}: 10 11buildPythonPackage rec { 12 pname = "http-parser"; 13 version = "0.9.0"; 14 format = "pyproject"; 15 16 src = fetchFromGitHub { 17 owner = "benoitc"; 18 repo = "http-parser"; 19 tag = version; 20 hash = "sha256-WHimvSaNcncwzLwwk5+ZNg7BbHF+hPr39SfidEDYfhU="; 21 }; 22 23 nativeBuildInputs = [ 24 cython 25 setuptools 26 ]; 27 28 preBuild = '' 29 # re-run cython 30 make -B 31 ''; 32 33 pythonImportsCheck = [ "http_parser" ]; 34 35 # The imp module is deprecated since version 3.4, and was removed in 3.12 36 # https://docs.python.org/3.11/library/imp.html 37 # Fix from: https://github.com/benoitc/http-parser/pull/101/ 38 patches = [ 39 (fetchpatch { 40 url = "https://github.com/benoitc/http-parser/commit/4d4984ce129253f9de475bfd3c683301c916e8b1.patch"; 41 hash = "sha256-d3k1X41/D9PpPWsDety2AiYyLv9LJIhpkOo3a6qKcB8="; 42 }) 43 ]; 44 45 nativeCheckInputs = [ pytestCheckHook ]; 46 47 meta = { 48 description = "HTTP request/response parser for python in C"; 49 homepage = "https://github.com/benoitc/http-parser"; 50 license = lib.licenses.mit; 51 maintainers = [ ]; 52 }; 53}