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