at master 1.9 kB view raw
1{ 2 lib, 3 fetchFromGitHub, 4 buildPythonPackage, 5 pytestCheckHook, 6 pycparser, 7 psutil, 8 dotnet-sdk_6, 9 buildDotnetModule, 10 clr-loader, 11 setuptools, 12}: 13 14let 15 pname = "pythonnet"; 16 version = "3.0.5"; 17 src = fetchFromGitHub { 18 owner = "pythonnet"; 19 repo = "pythonnet"; 20 tag = "v${version}"; 21 hash = "sha256-3LBrV/cQrXFKMFE1rCalDsPZ3rOY7RczqXoryMoVi14="; 22 }; 23 24 # This buildDotnetModule is used only to get nuget sources, the actual 25 # build is done in `buildPythonPackage` below. 26 dotnet-build = buildDotnetModule { 27 inherit pname version src; 28 projectFile = "src/runtime/Python.Runtime.csproj"; 29 testProjectFile = "src/testing/Python.Test.csproj"; 30 nugetDeps = ./deps.json; 31 dotnet-sdk = dotnet-sdk_6; 32 }; 33in 34buildPythonPackage { 35 inherit pname version src; 36 37 format = "pyproject"; 38 39 postPatch = '' 40 substituteInPlace pyproject.toml \ 41 --replace 'dynamic = ["version"]' 'version = "${version}"' 42 ''; 43 44 buildInputs = dotnet-build.nugetDeps; 45 46 nativeBuildInputs = [ 47 setuptools 48 dotnet-sdk_6 49 ]; 50 51 propagatedBuildInputs = [ 52 pycparser 53 clr-loader 54 ]; 55 56 pytestFlags = [ 57 # Run tests using .NET Core, Mono is unsupported for now due to find_library problem in clr-loader 58 "--runtime=coreclr" 59 ]; 60 61 nativeCheckInputs = [ 62 pytestCheckHook 63 psutil # needed for memory leak tests 64 ]; 65 66 # Rerun this when updating to refresh Nuget dependencies 67 passthru.fetch-deps = dotnet-build.fetch-deps; 68 69 meta = with lib; { 70 description = ".NET integration for Python"; 71 homepage = "https://pythonnet.github.io"; 72 changelog = "https://github.com/pythonnet/pythonnet/releases/tag/${src.tag}"; 73 license = licenses.mit; 74 # <https://github.com/pythonnet/pythonnet/issues/898> 75 badPlatforms = [ "aarch64-linux" ]; 76 maintainers = with maintainers; [ 77 jraygauthier 78 mdarocha 79 ]; 80 }; 81}