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}: 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 (replaceVars ./msgfmt-path.patch { 34 msgfmt = lib.getExe' gettext "msgfmt"; 35 }) 36 ]; 37 38 postPatch = '' 39 sed -i "s/--cov//" pyproject.toml 40 ''; 41 42 nativeBuildInputs = [ 43 flit-scm 44 wheel 45 ]; 46 47 propagatedBuildInputs = [ flit-core ]; 48 49 optional-dependencies = { 50 scm = [ flit-scm ]; 51 }; 52 53 nativeCheckInputs = [ 54 build 55 pytestCheckHook 56 wheel 57 ] ++ optional-dependencies.scm; 58 59 disabledTests = [ 60 # tests for missing msgfmt, but we always provide it 61 "test_compile_gettext_translations__no_gettext" 62 ]; 63 64 disabledTestPaths = [ 65 # calls python -m build, but can't find build 66 "tests/test_core.py" 67 "tests/test_scm.py" 68 ]; 69 70 pythonImportsCheck = [ "flit_gettext" ]; 71 72 meta = with lib; { 73 description = "Compiling gettext i18n messages during project bundling"; 74 homepage = "https://github.com/codingjoe/flit-gettext"; 75 license = licenses.bsd2; 76 maintainers = with maintainers; [ hexa ]; 77 }; 78}