1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pyparsing,
6 pytestCheckHook,
7 setuptools,
8}:
9
10buildPythonPackage rec {
11 pname = "kinparse";
12 version = "1.2.3";
13 pyproject = true;
14
15 src = fetchFromGitHub {
16 owner = "xesscorp";
17 repo = "kinparse";
18 tag = version;
19 hash = "sha256-170e2uhqpk6u/hahivWYubr3Ptb8ijymJSxhxrAfuyI=";
20 };
21
22 # Remove python2 build support as it breaks python >= 3.13
23 postPatch = ''
24 substituteInPlace setup.cfg \
25 --replace-fail "universal = 1" "universal = 0"
26 '';
27
28 build-system = [ setuptools ];
29
30 dependencies = [ pyparsing ];
31
32 pythonRemoveDeps = [ "future" ];
33
34 preCheck = ''
35 substituteInPlace tests/test_kinparse.py \
36 --replace-fail "data/" "$src/tests/data/"
37 '';
38
39 nativeCheckInputs = [ pytestCheckHook ];
40
41 pythonImportsCheck = [ "kinparse" ];
42
43 meta = {
44 description = "Parser for KiCad EESCHEMA netlists";
45 mainProgram = "kinparse";
46 homepage = "https://github.com/xesscorp/kinparse";
47 license = lib.licenses.mit;
48 maintainers = with lib.maintainers; [ matthuszagh ];
49 };
50}