depot/third_party/nixpkgs/pkgs/development/python-modules/xcffib/default.nix
Default email bcb2f287e1 Project import generated by Copybara.
GitOrigin-RevId: d603719ec6e294f034936c0d0dc06f689d91b6c3
2024-06-20 20:27:18 +05:30

56 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 = "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 ];
};
}