1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 replaceVars,
6
7 # build-system
8 flit-scm,
9 wheel,
10
11 # dependencies
12 flit-core,
13 gettext,
14
15 # tests
16 build,
17 pytestCheckHook,
18 pytest-cov-stub,
19}:
20
21buildPythonPackage rec {
22 pname = "flit-gettext";
23 version = "1.0.1";
24 pyproject = true;
25
26 src = fetchFromGitHub {
27 owner = "codingjoe";
28 repo = "flit-gettext";
29 rev = version;
30 hash = "sha256-rrGRkZ7GeFdDZ7m1oLq/7nEjx6NY2+YWvLrtfRr4+Jw=";
31 };
32
33 patches = [
34 (replaceVars ./msgfmt-path.patch {
35 msgfmt = lib.getExe' gettext "msgfmt";
36 })
37 ];
38
39 nativeBuildInputs = [
40 flit-scm
41 wheel
42 ];
43
44 propagatedBuildInputs = [ flit-core ];
45
46 optional-dependencies = {
47 scm = [ flit-scm ];
48 };
49
50 nativeCheckInputs = [
51 build
52 pytestCheckHook
53 pytest-cov-stub
54 wheel
55 ]
56 ++ optional-dependencies.scm;
57
58 disabledTests = [
59 # tests for missing msgfmt, but we always provide it
60 "test_compile_gettext_translations__no_gettext"
61 ];
62
63 disabledTestPaths = [
64 # calls python -m build, but can't find build
65 "tests/test_core.py"
66 "tests/test_scm.py"
67 ];
68
69 pythonImportsCheck = [ "flit_gettext" ];
70
71 meta = with lib; {
72 description = "Compiling gettext i18n messages during project bundling";
73 homepage = "https://github.com/codingjoe/flit-gettext";
74 license = licenses.bsd2;
75 maintainers = with maintainers; [ hexa ];
76 };
77}