depot/third_party/nixpkgs/pkgs/development/python-modules/readchar/default.nix
Default email e7ec2969af Project import generated by Copybara.
GitOrigin-RevId: 9b19f5e77dd906cb52dade0b7bd280339d2a1f3d
2024-01-13 09:15:51 +01:00

53 lines
1.2 KiB
Nix

{ lib
, buildPythonPackage
, fetchFromGitHub
# build-system
, setuptools
# tests
, pytestCheckHook
, pexpect
}:
buildPythonPackage rec {
pname = "readchar";
version = "4.0.5";
pyproject = true;
# Don't use wheels on PyPI
src = fetchFromGitHub {
owner = "magmax";
repo = "python-${pname}";
rev = "refs/tags/v${version}";
hash = "sha256-Ru18lh+9tXtvttypnob0HNPKBiGF7E9HDL21l1AAGa8=";
};
postPatch = ''
substituteInPlace setup.cfg \
--replace "--cov=readchar" "" \
--replace "attr: readchar.__version__" "${version}"
# run Linux tests on Darwin as well
# see https://github.com/magmax/python-readchar/pull/99 for why this is not upstreamed
substituteInPlace tests/linux/conftest.py \
--replace 'sys.platform.startswith("linux")' 'sys.platform.startswith(("darwin", "linux"))'
'';
nativeBuildInputs = [
setuptools
];
pythonImportsCheck = [ "readchar" ];
nativeCheckInputs = [
pytestCheckHook
pexpect
];
meta = with lib; {
homepage = "https://github.com/magmax/python-readchar";
description = "Python library to read characters and key strokes";
license = licenses.mit;
maintainers = [ maintainers.mmahut ];
};
}