Merge pull request #307098 from r-ryantm/auto-update/cilium-cli
[NixPkgs.git] / pkgs / development / python-modules / readchar / default.nix
blob115e0c284a2a875326503744cbe101c85fc233c3
1 { lib
2 , buildPythonPackage
3 , fetchFromGitHub
5 # build-system
6 , setuptools
8 # tests
9 , pytestCheckHook
10 , pexpect
13 buildPythonPackage rec {
14   pname = "readchar";
15   version = "4.0.6";
16   pyproject = true;
18   # Don't use wheels on PyPI
19   src = fetchFromGitHub {
20     owner = "magmax";
21     repo = "python-${pname}";
22     rev = "refs/tags/v${version}";
23     hash = "sha256-XowLJ9YAHhP9nInFVYtoLEOmlWBRWQX259vwm9SVVZU=";
24   };
26   postPatch = ''
27     substituteInPlace setup.cfg \
28       --replace "--cov=readchar" "" \
29       --replace "attr: readchar.__version__" "${version}"
30     # run Linux tests on Darwin as well
31     # see https://github.com/magmax/python-readchar/pull/99 for why this is not upstreamed
32     substituteInPlace tests/linux/conftest.py \
33       --replace 'sys.platform.startswith("linux")' 'sys.platform.startswith(("darwin", "linux"))'
34   '';
36   nativeBuildInputs = [
37     setuptools
38   ];
40   pythonImportsCheck = [ "readchar" ];
42   nativeCheckInputs = [
43     pytestCheckHook
44     pexpect
45   ];
47   meta = with lib; {
48     homepage = "https://github.com/magmax/python-readchar";
49     description = "Python library to read characters and key strokes";
50     license = licenses.mit;
51     maintainers = [ maintainers.mmahut ];
52   };