1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchPypi, 6 fetchpatch, 7 pythonOlder, 8 9 # build-system, dependencies 10 meson, 11 ninja, 12 pyproject-metadata, 13 tomli, 14 15 # tests 16 cython, 17 gitMinimal, 18 pytestCheckHook, 19 pytest-mock, 20}: 21 22buildPythonPackage rec { 23 pname = "meson-python"; 24 version = "0.18.0"; 25 pyproject = true; 26 27 src = fetchPypi { 28 inherit version; 29 pname = "meson_python"; 30 hash = "sha256-xWqZ7J32aaQGYv5GlgMhr25LFBBsFNsihwnBYo4jhI0="; 31 }; 32 33 patches = [ 34 (fetchpatch { 35 # TODO: Remove in 0.19.0 36 url = "https://github.com/mesonbuild/meson-python/commit/1e69e7a23f2b24d688dc4220e93de6f0e2bcf9d2.patch"; 37 hash = "sha256-FC2ll/OrLV1R0CDB6UkrknVASJQ7rSU+sApdAk75x44="; 38 }) 39 ]; 40 41 build-system = [ 42 meson 43 ninja 44 pyproject-metadata 45 ] 46 ++ lib.optionals (pythonOlder "3.11") [ tomli ]; 47 48 dependencies = [ 49 meson 50 ninja 51 pyproject-metadata 52 ] 53 ++ lib.optionals (pythonOlder "3.11") [ tomli ]; 54 55 nativeCheckInputs = [ 56 cython 57 gitMinimal 58 pytestCheckHook 59 pytest-mock 60 ]; 61 62 # meson-python respectes MACOSX_DEPLOYMENT_TARGET, but compares it with the 63 # actual platform version during tests, which mismatches. 64 # https://github.com/mesonbuild/meson-python/issues/760 65 # FIXME: drop in 0.19.0 66 preCheck = 67 if stdenv.hostPlatform.isDarwin then 68 '' 69 unset MACOSX_DEPLOYMENT_TARGET 70 '' 71 else 72 null; 73 74 setupHooks = [ ./add-build-flags.sh ]; 75 76 meta = { 77 changelog = "https://github.com/mesonbuild/meson-python/blob/${version}/CHANGELOG.rst"; 78 description = "Meson Python build backend (PEP 517)"; 79 homepage = "https://github.com/mesonbuild/meson-python"; 80 license = [ lib.licenses.mit ]; 81 maintainers = with lib.maintainers; [ doronbehar ]; 82 teams = [ lib.teams.python ]; 83 }; 84}