2023-07-15 17:15:38 +00:00
|
|
|
{ lib
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchPypi
|
|
|
|
, buildPythonPackage
|
2021-05-20 23:08:51 +00:00
|
|
|
, pytestCheckHook
|
2020-04-24 23:36:52 +00:00
|
|
|
, pycparser
|
|
|
|
, psutil
|
2023-07-15 17:15:38 +00:00
|
|
|
, dotnet-sdk
|
|
|
|
, buildDotnetModule
|
|
|
|
, clr-loader
|
|
|
|
, setuptools
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
pname = "pythonnet";
|
2023-07-15 17:15:38 +00:00
|
|
|
version = "3.0.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
src = fetchPypi {
|
2023-07-15 17:15:38 +00:00
|
|
|
pname = "pythonnet";
|
|
|
|
inherit version;
|
|
|
|
sha256 = "sha256-7U9/f5VRVAQRLds9oWOOGhATy1bmTEjE+mAwPwKwo90=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
# This buildDotnetModule is used only to get nuget sources, the actual
|
|
|
|
# build is done in `buildPythonPackage` below.
|
|
|
|
dotnet-build = buildDotnetModule {
|
|
|
|
inherit pname version src;
|
|
|
|
nugetDeps = ./deps.nix;
|
|
|
|
};
|
|
|
|
in
|
|
|
|
buildPythonPackage {
|
|
|
|
inherit pname version src;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
format = "pyproject";
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace pyproject.toml \
|
|
|
|
--replace 'dynamic = ["version"]' 'version = "${version}"'
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2023-07-15 17:15:38 +00:00
|
|
|
setuptools
|
|
|
|
dotnet-sdk
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
pycparser
|
|
|
|
clr-loader
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
pytestFlagsArray = [
|
|
|
|
# Run tests using .NET Core, Mono is unsupported for now due to find_library problem in clr-loader
|
|
|
|
"--runtime coreclr"
|
2021-05-20 23:08:51 +00:00
|
|
|
];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2021-05-20 23:08:51 +00:00
|
|
|
pytestCheckHook
|
2020-04-24 23:36:52 +00:00
|
|
|
psutil # needed for memory leak tests
|
|
|
|
];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
# Perform dotnet restore based on the nuget-source
|
|
|
|
preConfigure = ''
|
|
|
|
dotnet restore \
|
|
|
|
-p:ContinuousIntegrationBuild=true \
|
|
|
|
-p:Deterministic=true \
|
|
|
|
--source ${dotnet-build.nuget-source}
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
# Rerun this when updating to refresh Nuget dependencies
|
|
|
|
passthru.fetch-deps = dotnet-build.fetch-deps;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
2023-07-15 17:15:38 +00:00
|
|
|
description = ".NET integration for Python";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://pythonnet.github.io";
|
|
|
|
license = licenses.mit;
|
2021-05-20 23:08:51 +00:00
|
|
|
# <https://github.com/pythonnet/pythonnet/issues/898>
|
|
|
|
badPlatforms = [ "aarch64-linux" ];
|
2023-07-15 17:15:38 +00:00
|
|
|
maintainers = with maintainers; [ jraygauthier mdarocha ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|