nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 stdenv,
6 replaceVars,
7
8 # build-system
9 hatchling,
10
11 # native dependencies
12 libxrandr,
13 libxfixes,
14 libx11,
15
16 # tests
17 lsof,
18 pillow,
19 pytest-cov-stub,
20 pytest,
21 pyvirtualdisplay,
22 xvfb-run,
23}:
24
25buildPythonPackage rec {
26 pname = "mss";
27 version = "10.1.0";
28 pyproject = true;
29
30 src = fetchPypi {
31 inherit pname version;
32 hash = "sha256-cYK69+4WylaeKAQCi2q5vL9r5cRvwogIQPM7UTuctPg=";
33 };
34
35 patches = lib.optionals stdenv.hostPlatform.isLinux [
36 (replaceVars ./linux-paths.patch {
37 x11 = "${libx11}/lib/libX11.so";
38 xfixes = "${libxfixes}/lib/libXfixes.so";
39 xrandr = "${libxrandr}/lib/libXrandr.so";
40 })
41 ];
42
43 build-system = [ hatchling ];
44
45 doCheck = stdenv.hostPlatform.isLinux;
46
47 nativeCheckInputs = [
48 lsof
49 pillow
50 pytest-cov-stub
51 pytest
52 pyvirtualdisplay
53 xvfb-run
54 ];
55
56 checkPhase = ''
57 runHook preCheck
58 xvfb-run pytest -k "not test_grab_with_tuple and not test_grab_with_tuple_percents and not test_resource_leaks"
59 runHook postCheck
60 '';
61
62 pythonImportsCheck = [ "mss" ];
63
64 meta = {
65 description = "Cross-platform multiple screenshots module";
66 mainProgram = "mss";
67 homepage = "https://github.com/BoboTiG/python-mss";
68 changelog = "https://github.com/BoboTiG/python-mss/blob/v${version}/CHANGELOG.md";
69 license = lib.licenses.mit;
70 maintainers = with lib.maintainers; [ austinbutler ];
71 };
72}