2022-02-10 20:34:41 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
|
|
|
|
# tests
|
|
|
|
, pytestCheckHook
|
|
|
|
, pexpect
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "readchar";
|
2023-03-27 19:17:25 +00:00
|
|
|
version = "4.0.5";
|
2022-02-10 20:34:41 +00:00
|
|
|
format = "setuptools";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# Don't use wheels on PyPI
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "magmax";
|
|
|
|
repo = "python-${pname}";
|
2023-01-20 10:41:00 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2023-03-27 19:17:25 +00:00
|
|
|
hash = "sha256-Ru18lh+9tXtvttypnob0HNPKBiGF7E9HDL21l1AAGa8=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.cfg \
|
2023-01-20 10:41:00 +00:00
|
|
|
--replace "--cov=readchar" ""
|
2023-03-04 12:14:45 +00:00
|
|
|
# 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"))'
|
2022-02-10 20:34:41 +00:00
|
|
|
'';
|
|
|
|
|
2023-03-04 12:14:45 +00:00
|
|
|
pythonImportsCheck = [ "readchar" ];
|
2022-02-10 20:34:41 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2022-02-10 20:34:41 +00:00
|
|
|
pytestCheckHook
|
|
|
|
pexpect
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/magmax/python-readchar";
|
|
|
|
description = "Python library to read characters and key strokes";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = [ maintainers.mmahut ];
|
|
|
|
};
|
|
|
|
}
|