1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch2,
6 mock,
7 pyserial,
8 pytestCheckHook,
9 pythonOlder,
10}:
11
12buildPythonPackage rec {
13 pname = "pylacrosse";
14 version = "0.4";
15 format = "setuptools";
16
17 disabled = pythonOlder "3.7";
18
19 src = fetchFromGitHub {
20 owner = "hthiery";
21 repo = "python-lacrosse";
22 tag = version;
23 hash = "sha256-jrkehoPLYbutDfxMBO/vlx4nMylTNs/gtvoBTFHFsDw=";
24 };
25
26 patches = [
27 # Migrate to pytest, https://github.com/hthiery/python-lacrosse/pull/17
28 (fetchpatch2 {
29 url = "https://github.com/hthiery/python-lacrosse/commit/cc2623c667bc252360a9b5ccb4fc05296cf23d9c.patch?full_index=1";
30 hash = "sha256-LKryLnXMKj1lVClneyHNVOWM5KPPhOGy0/FX/7Qy/jU=";
31 })
32 ];
33
34 postPatch = ''
35 substituteInPlace setup.py \
36 --replace "version = version," "version = '${version}',"
37 '';
38
39 propagatedBuildInputs = [ pyserial ];
40
41 nativeCheckInputs = [
42 mock
43 pytestCheckHook
44 ];
45
46 pythonImportsCheck = [ "pylacrosse" ];
47
48 meta = with lib; {
49 description = "Python library for Jeelink LaCrosse";
50 mainProgram = "pylacrosse";
51 homepage = "https://github.com/hthiery/python-lacrosse";
52 license = with licenses; [ lgpl2Plus ];
53 maintainers = with maintainers; [ fab ];
54 };
55}