1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, freezegun
5, gettext
6, importlib-metadata
7, pytestCheckHook
8, pythonOlder
9, setuptools
10, setuptools-scm
11}:
12
13buildPythonPackage rec {
14 version = "4.4.0";
15 pname = "humanize";
16 format = "pyproject";
17
18 disabled = pythonOlder "3.7";
19
20 src = fetchFromGitHub {
21 owner = "python-humanize";
22 repo = pname;
23 rev = version;
24 hash = "sha256-XxlmOs3sfHOLTkrKGsHRiBWpuCIPJua2VkKxDmjOeWE=";
25 };
26
27 SETUPTOOLS_SCM_PRETEND_VERSION = version;
28
29 nativeBuildInputs = [
30 setuptools-scm
31 gettext
32 ];
33
34 propagatedBuildInputs = [
35 setuptools
36 ] ++ lib.optionals (pythonOlder "3.8") [
37 importlib-metadata
38 ];
39
40 postBuild = ''
41 scripts/generate-translation-binaries.sh
42 '';
43
44 postInstall = ''
45 cp -r 'src/humanize/locale' "$out/lib/"*'/site-packages/humanize/'
46 '';
47
48 checkInputs = [
49 freezegun
50 pytestCheckHook
51 ];
52
53 pythonImportsCheck = [
54 "humanize"
55 ];
56
57 meta = with lib; {
58 description = "Python humanize utilities";
59 homepage = "https://github.com/python-humanize/humanize";
60 license = licenses.mit;
61 maintainers = with maintainers; [ rmcgibbo Luflosi ];
62 };
63}