1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4
5# tests
6, pytestCheckHook
7, pexpect
8}:
9
10buildPythonPackage rec {
11 pname = "readchar";
12 version = "4.0.5";
13 format = "setuptools";
14
15 # Don't use wheels on PyPI
16 src = fetchFromGitHub {
17 owner = "magmax";
18 repo = "python-${pname}";
19 rev = "refs/tags/v${version}";
20 hash = "sha256-Ru18lh+9tXtvttypnob0HNPKBiGF7E9HDL21l1AAGa8=";
21 };
22
23 postPatch = ''
24 substituteInPlace setup.cfg \
25 --replace "--cov=readchar" ""
26 # run Linux tests on Darwin as well
27 # see https://github.com/magmax/python-readchar/pull/99 for why this is not upstreamed
28 substituteInPlace tests/linux/conftest.py \
29 --replace 'sys.platform.startswith("linux")' 'sys.platform.startswith(("darwin", "linux"))'
30 '';
31
32 pythonImportsCheck = [ "readchar" ];
33
34 nativeCheckInputs = [
35 pytestCheckHook
36 pexpect
37 ];
38
39 meta = with lib; {
40 homepage = "https://github.com/magmax/python-readchar";
41 description = "Python library to read characters and key strokes";
42 license = licenses.mit;
43 maintainers = [ maintainers.mmahut ];
44 };
45}