1{ lib, buildPythonPackage, fetchPypi, cython, pytestCheckHook }: 2 3buildPythonPackage rec { 4 pname = "cwcwidth"; 5 version = "0.1.4"; 6 format = "pyproject"; 7 8 src = fetchPypi { 9 inherit pname version; 10 sha256 = "1azrphpkcyggg38xvkfb9dpc4xmmm90p02kf8dkqd4d6j5w96aj8"; 11 }; 12 13 nativeBuildInputs = [ cython ]; 14 15 checkInputs = [ pytestCheckHook ]; 16 # Hack needed to make pytest + cython work 17 # https://github.com/NixOS/nixpkgs/pull/82410#issuecomment-827186298 18 preCheck = '' 19 export HOME=$(mktemp -d) 20 cp -r $TMP/$sourceRoot/tests $HOME 21 pushd $HOME 22 ''; 23 postCheck = "popd"; 24 25 pythonImportsCheck = [ "cwcwidth" ]; 26 27 meta = with lib; { 28 description = "Python bindings for wc(s)width"; 29 homepage = "https://github.com/sebastinas/cwcwidth"; 30 changelog = "https://github.com/sebastinas/cwcwidth/blob/main/CHANGELOG.md"; 31 license = licenses.mit; 32 maintainers = with maintainers; [ ]; 33 }; 34}