2022-06-16 17:23:12 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchPypi
|
|
|
|
, fetchNuGet
|
|
|
|
, buildPythonPackage
|
2021-05-20 23:08:51 +00:00
|
|
|
, pytestCheckHook
|
2020-04-24 23:36:52 +00:00
|
|
|
, pycparser
|
|
|
|
, psutil
|
2021-02-05 17:12:51 +00:00
|
|
|
, pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
, dotnetbuildhelpers
|
|
|
|
, clang
|
2020-06-18 07:06:33 +00:00
|
|
|
, glib
|
2020-04-24 23:36:52 +00:00
|
|
|
, mono
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
dotnetPkgs = [
|
|
|
|
(fetchNuGet {
|
2021-12-24 04:21:11 +00:00
|
|
|
pname = "UnmanagedExports";
|
2021-05-20 23:08:51 +00:00
|
|
|
version = "1.2.7";
|
|
|
|
sha256 = "0bfrhpmq556p0swd9ssapw4f2aafmgp930jgf00sy89hzg2bfijf";
|
|
|
|
outputFiles = [ "*" ];
|
|
|
|
})
|
|
|
|
(fetchNuGet {
|
2021-12-24 04:21:11 +00:00
|
|
|
pname = "NUnit";
|
2021-05-20 23:08:51 +00:00
|
|
|
version = "3.12.0";
|
|
|
|
sha256 = "1880j2xwavi8f28vxan3hyvdnph4nlh5sbmh285s4lc9l0b7bdk2";
|
|
|
|
outputFiles = [ "*" ];
|
|
|
|
})
|
|
|
|
(fetchNuGet {
|
2021-12-24 04:21:11 +00:00
|
|
|
pname = "System.ValueTuple";
|
2021-05-20 23:08:51 +00:00
|
|
|
version = "4.5.0";
|
|
|
|
sha256 = "00k8ja51d0f9wrq4vv5z2jhq8hy31kac2rg0rv06prylcybzl8cy";
|
|
|
|
outputFiles = [ "*" ];
|
|
|
|
})
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pythonnet";
|
2021-05-20 23:08:51 +00:00
|
|
|
version = "2.5.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2021-05-20 23:08:51 +00:00
|
|
|
sha256 = "1qzdc6jd7i9j7p6bcihnr98y005gv1358xqdr1plpbpnl6078a5p";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.py --replace 'self._install_packages()' '#self._install_packages()'
|
|
|
|
'';
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
[ -z "''${dontPlacateNuget-}" ] && placate-nuget.sh
|
|
|
|
[ -z "''${dontPlacatePaket-}" ] && placate-paket.sh
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
pycparser
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
dotnetbuildhelpers
|
|
|
|
clang
|
|
|
|
|
|
|
|
mono
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
] ++ dotnetPkgs;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
2020-06-18 07:06:33 +00:00
|
|
|
glib
|
2020-04-24 23:36:52 +00:00
|
|
|
mono
|
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
|
|
|
|
];
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
rm -rf packages
|
|
|
|
mkdir packages
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
${builtins.concatStringsSep "\n" (
|
|
|
|
builtins.map (
|
2021-12-24 04:21:11 +00:00
|
|
|
x: ''ln -s ${x}/lib/dotnet/${x.pname} ./packages/${x.pname}.${x.version}''
|
2021-05-20 23:08:51 +00:00
|
|
|
) dotnetPkgs)}
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# Setting TERM=xterm fixes an issue with terminfo in mono: System.Exception: Magic number is wrong: 542
|
|
|
|
export TERM=xterm
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
2022-06-16 17:23:12 +00:00
|
|
|
broken = stdenv.isDarwin;
|
2020-04-24 23:36:52 +00:00
|
|
|
description = ".Net and Mono integration for Python";
|
|
|
|
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" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = with maintainers; [ jraygauthier ];
|
|
|
|
};
|
|
|
|
}
|