summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/kinparse/default.nix
blob: 7dc864b5b834104a4ba4fe70dcdc7fdf301f5b02 (plain)
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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  pyparsing,
  pytestCheckHook,
  setuptools,
}:

buildPythonPackage rec {
  pname = "kinparse";
  version = "1.2.3";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "xesscorp";
    repo = "kinparse";
    tag = version;
    hash = "sha256-170e2uhqpk6u/hahivWYubr3Ptb8ijymJSxhxrAfuyI=";
  };

  # Remove python2 build support as it breaks python >= 3.13
  postPatch = ''
    substituteInPlace setup.cfg \
      --replace-fail "universal = 1" "universal = 0"
  '';

  build-system = [ setuptools ];

  dependencies = [ pyparsing ];

  pythonRemoveDeps = [ "future" ];

  preCheck = ''
    substituteInPlace tests/test_kinparse.py \
      --replace-fail "data/" "$src/tests/data/"
  '';

  nativeCheckInputs = [ pytestCheckHook ];

  pythonImportsCheck = [ "kinparse" ];

  meta = {
    description = "Parser for KiCad EESCHEMA netlists";
    mainProgram = "kinparse";
    homepage = "https://github.com/xesscorp/kinparse";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ matthuszagh ];
  };
}