depot/third_party/nixpkgs/pkgs/development/python-modules/xcffib/default.nix
Default email 5c370c0b2a Project import generated by Copybara.
GitOrigin-RevId: 33d1e753c82ffc557b4a585c77de43d4c922ebb5
2024-05-15 17:35:15 +02:00

61 lines
1.2 KiB
Nix

{ lib
, buildPythonPackage
, cffi
, fetchPypi
, pytestCheckHook
, pythonOlder
, xorg
}:
buildPythonPackage rec {
pname = "xcffib";
version = "1.5.0";
format = "setuptools";
disabled = pythonOlder "3.7";
src = fetchPypi {
inherit pname version;
hash = "sha256-qVyUZfL5e0/O3mBr0eCEB6Mt9xy3YP1Xv+U2d9tpGsw=";
};
postPatch = ''
# Hardcode cairo library path
sed -e 's,ffi\.dlopen(,&"${xorg.libxcb.out}/lib/" + ,' -i xcffib/__init__.py
'';
propagatedNativeBuildInputs = [
cffi
];
propagatedBuildInputs = [
cffi
];
nativeCheckInputs = [
pytestCheckHook
xorg.xeyes
xorg.xorgserver
];
preCheck = ''
# import from $out
rm -r xcffib
'';
pythonImportsCheck = [
"xcffib"
];
# Tests use xvfb
__darwinAllowLocalNetworking = true;
meta = with lib; {
description = "A drop in replacement for xpyb, an XCB python binding";
homepage = "https://github.com/tych0/xcffib";
changelog = "https://github.com/tych0/xcffib/releases/tag/v${version}";
license = licenses.asl20;
platforms = platforms.linux ++ platforms.darwin ++ platforms.windows;
maintainers = with maintainers; [ kamilchm ];
};
}