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