about summary refs log tree commit diff
path: root/pkgs/development/python-modules/http-parser/default.nix
blob: 7e53465939f2819fd43d8fc6b10e0c436fe8b601 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  cython,
  setuptools,
  pytestCheckHook,
  fetchpatch,
}:

buildPythonPackage rec {
  pname = "http-parser";
  version = "0.9.0";
  format = "pyproject";

  src = fetchFromGitHub {
    owner = "benoitc";
    repo = pname;
    rev = "refs/tags/${version}";
    hash = "sha256-WHimvSaNcncwzLwwk5+ZNg7BbHF+hPr39SfidEDYfhU=";
  };

  nativeBuildInputs = [
    cython
    setuptools
  ];

  preBuild = ''
    # re-run cython
    make -B
  '';

  pythonImportsCheck = [ "http_parser" ];

  # The imp module is deprecated since version 3.4, and was removed in 3.12
  # https://docs.python.org/3.11/library/imp.html
  # Fix from: https://github.com/benoitc/http-parser/pull/101/
  patches = [
    (fetchpatch {
      url = "https://github.com/benoitc/http-parser/commit/4d4984ce129253f9de475bfd3c683301c916e8b1.patch";
      hash = "sha256-d3k1X41/D9PpPWsDety2AiYyLv9LJIhpkOo3a6qKcB8=";
    })
  ];

  nativeCheckInputs = [ pytestCheckHook ];

  meta = {
    description = "HTTP request/response parser for python in C";
    homepage = "https://github.com/benoitc/http-parser";
    license = lib.licenses.mit;
    maintainers = [ ];
  };
}