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