depot/third_party/nixpkgs/pkgs/development/python-modules/screeninfo/default.nix
Default email 5083ee08a2 Project import generated by Copybara.
GitOrigin-RevId: 10ecda252ce1b3b1d6403caeadbcc8f30d5ab796
2022-09-30 06:47:45 -05:00

63 lines
1.5 KiB
Nix

{ stdenv
, lib
, buildPythonApplication
, dataclasses
, fetchFromGitHub
, libX11
, libXinerama
, libXrandr
, poetry-core
, pytestCheckHook
, pythonOlder
}:
buildPythonApplication rec {
pname = "screeninfo";
version = "0.8.1";
format = "pyproject";
disabled = pythonOlder "3.6";
src = fetchFromGitHub {
owner = "rr-";
repo = pname;
rev = "refs/tags/${version}";
hash = "sha256-TEy4wff0eRRkX98yK9054d33Tm6G6qWrd9Iv+ITcFmA=";
};
nativeBuildInputs = [
poetry-core
];
propagatedBuildInputs = lib.optionals (pythonOlder "3.7") [
dataclasses
];
postPatch = ''
substituteInPlace screeninfo/enumerators/xinerama.py \
--replace 'load_library("X11")' 'ctypes.cdll.LoadLibrary("${libX11}/lib/libX11.so")' \
--replace 'load_library("Xinerama")' 'ctypes.cdll.LoadLibrary("${libXinerama}/lib/libXinerama.so")'
substituteInPlace screeninfo/enumerators/xrandr.py \
--replace 'load_library("X11")' 'ctypes.cdll.LoadLibrary("${libX11}/lib/libX11.so")' \
--replace 'load_library("Xrandr")' 'ctypes.cdll.LoadLibrary("${libXrandr}/lib/libXrandr.so")'
'';
checkInputs = [
pytestCheckHook
];
disabledTestPaths = [
# We don't have a screen
"tests/test_screeninfo.py"
];
pythonImportsCheck = [ "screeninfo" ];
meta = with lib; {
broken = stdenv.isDarwin;
description = "Fetch location and size of physical screens";
homepage = "https://github.com/rr-/screeninfo";
license = licenses.mit;
maintainers = with maintainers; [ nickhu ];
};
}