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