2018-02-05 21:58:25 +00:00
|
|
|
{ lib
|
|
|
|
, fetchPypi
|
|
|
|
, fetchNuGet
|
|
|
|
, buildPythonPackage
|
2021-05-14 03:41:14 +01:00
|
|
|
, pytestCheckHook
|
2018-02-05 21:58:25 +00:00
|
|
|
, pycparser
|
2019-08-03 22:48:56 +01:00
|
|
|
, psutil
|
2021-01-19 06:50:56 +00:00
|
|
|
, pkg-config
|
2018-02-05 21:58:25 +00:00
|
|
|
, dotnetbuildhelpers
|
|
|
|
, clang
|
2020-06-14 11:56:52 +01:00
|
|
|
, glib
|
2018-02-05 21:58:25 +00:00
|
|
|
, mono
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
2021-05-14 03:41:14 +01:00
|
|
|
dotnetPkgs = [
|
|
|
|
(fetchNuGet {
|
|
|
|
baseName = "UnmanagedExports";
|
|
|
|
version = "1.2.7";
|
|
|
|
sha256 = "0bfrhpmq556p0swd9ssapw4f2aafmgp930jgf00sy89hzg2bfijf";
|
|
|
|
outputFiles = [ "*" ];
|
|
|
|
})
|
|
|
|
(fetchNuGet {
|
|
|
|
baseName = "NUnit";
|
|
|
|
version = "3.12.0";
|
|
|
|
sha256 = "1880j2xwavi8f28vxan3hyvdnph4nlh5sbmh285s4lc9l0b7bdk2";
|
|
|
|
outputFiles = [ "*" ];
|
|
|
|
})
|
|
|
|
(fetchNuGet {
|
|
|
|
baseName = "System.ValueTuple";
|
|
|
|
version = "4.5.0";
|
|
|
|
sha256 = "00k8ja51d0f9wrq4vv5z2jhq8hy31kac2rg0rv06prylcybzl8cy";
|
|
|
|
outputFiles = [ "*" ];
|
|
|
|
})
|
|
|
|
];
|
2018-02-05 21:58:25 +00:00
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pythonnet";
|
2021-05-14 03:41:14 +01:00
|
|
|
version = "2.5.2";
|
2018-02-05 21:58:25 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2021-05-14 03:41:14 +01:00
|
|
|
sha256 = "1qzdc6jd7i9j7p6bcihnr98y005gv1358xqdr1plpbpnl6078a5p";
|
2018-02-05 21:58:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.py --replace 'self._install_packages()' '#self._install_packages()'
|
|
|
|
'';
|
|
|
|
|
|
|
|
preConfigure = ''
|
2019-10-31 16:50:15 +00:00
|
|
|
[ -z "''${dontPlacateNuget-}" ] && placate-nuget.sh
|
|
|
|
[ -z "''${dontPlacatePaket-}" ] && placate-paket.sh
|
2018-02-05 21:58:25 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
pycparser
|
|
|
|
|
2021-01-19 06:50:56 +00:00
|
|
|
pkg-config
|
2018-02-05 21:58:25 +00:00
|
|
|
dotnetbuildhelpers
|
|
|
|
clang
|
|
|
|
|
2019-08-03 22:48:56 +01:00
|
|
|
mono
|
|
|
|
|
2021-05-14 03:41:14 +01:00
|
|
|
] ++ dotnetPkgs;
|
2018-02-05 21:58:25 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
2020-06-14 11:56:52 +01:00
|
|
|
glib
|
2018-02-05 21:58:25 +00:00
|
|
|
mono
|
2021-05-14 03:41:14 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
checkInputs = [
|
|
|
|
pytestCheckHook
|
2019-08-03 22:48:56 +01:00
|
|
|
psutil # needed for memory leak tests
|
2018-02-05 21:58:25 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
rm -rf packages
|
|
|
|
mkdir packages
|
|
|
|
|
2021-05-14 03:41:14 +01:00
|
|
|
${builtins.concatStringsSep "\n" (
|
|
|
|
builtins.map (
|
|
|
|
x: ''ln -s ${x}/lib/dotnet/${x.baseName} ./packages/${x.baseName}.${x.version}''
|
|
|
|
) dotnetPkgs)}
|
2019-08-03 22:48:56 +01:00
|
|
|
|
|
|
|
# Setting TERM=xterm fixes an issue with terminfo in mono: System.Exception: Magic number is wrong: 542
|
|
|
|
export TERM=xterm
|
2018-02-05 21:58:25 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = ".Net and Mono integration for Python";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://pythonnet.github.io";
|
2018-02-05 21:58:25 +00:00
|
|
|
license = licenses.mit;
|
2021-05-14 03:41:14 +01:00
|
|
|
# <https://github.com/pythonnet/pythonnet/issues/898>
|
|
|
|
badPlatforms = [ "aarch64-linux" ];
|
2018-02-05 21:58:25 +00:00
|
|
|
maintainers = with maintainers; [ jraygauthier ];
|
|
|
|
};
|
|
|
|
}
|