python310Packages.pyserial: add pythonImportsCheck

- disable on obsolete Python releases
- add format
This commit is contained in:
Fabian Affolter 2022-06-07 10:10:58 +02:00
parent 499c5044ff
commit 0031ccab55

View File

@ -1,12 +1,21 @@
{ stdenv, lib, fetchPypi, buildPythonPackage }:
{ lib
, stdenv
, buildPythonPackage
, fetchPypi
, python
, pythonOlder
}:
buildPythonPackage rec {
pname = "pyserial";
version="3.5";
version = "3.5";
format = "setuptools";
disabled = pythonOlder "3.7";
src = fetchPypi {
inherit pname version;
sha256 = "1nyd4m4mnrz8scbfqn4zpq8gnbl4x42w5zz62vcgpzqd2waf0xrw";
hash = "sha256-PHfgFBcN//vYFub/wgXphC77EL6fWOwW0+hnW0klzds=";
};
patches = [
@ -14,13 +23,22 @@ buildPythonPackage rec {
./002-rfc2217-timeout-setter-for-rfc2217.patch
];
checkPhase = "python -m unittest discover -s test";
doCheck = !stdenv.hostPlatform.isDarwin; # broken on darwin
checkPhase = ''
runHook preCheck
${python.interpreter} -m unittest discover -s test
runHook postCheck
'';
pythonImportsCheck = [
"serial"
];
meta = with lib; {
homepage = "https://github.com/pyserial/pyserial";
license = licenses.psfl;
description = "Python serial port extension";
homepage = "https://github.com/pyserial/pyserial";
license = licenses.bsd3;
maintainers = with maintainers; [ makefu ];
};
}