2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
2022-02-10 20:34:41 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# build-system
|
|
|
|
setuptools,
|
2024-01-13 08:15:51 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# tests
|
|
|
|
pytestCheckHook,
|
|
|
|
pexpect,
|
2022-02-10 20:34:41 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "readchar";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "4.0.6";
|
2024-01-13 08:15:51 +00:00
|
|
|
pyproject = true;
|
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}";
|
2024-04-21 15:54:59 +00:00
|
|
|
hash = "sha256-XowLJ9YAHhP9nInFVYtoLEOmlWBRWQX259vwm9SVVZU=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.cfg \
|
2024-01-13 08:15:51 +00:00
|
|
|
--replace "--cov=readchar" "" \
|
|
|
|
--replace "attr: readchar.__version__" "${version}"
|
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
|
|
|
'';
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeBuildInputs = [ setuptools ];
|
2024-01-13 08:15:51 +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 ];
|
|
|
|
};
|
|
|
|
}
|