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