1{ lib
2, fetchPypi
3, fetchNuGet
4, buildPythonPackage
5, python
6, pytest
7, pycparser
8, pkgconfig
9, dotnetbuildhelpers
10, clang
11, mono
12}:
13
14let
15
16 UnmanagedExports127 = fetchNuGet {
17 baseName = "UnmanagedExports";
18 version = "1.2.7";
19 sha256 = "0bfrhpmq556p0swd9ssapw4f2aafmgp930jgf00sy89hzg2bfijf";
20 outputFiles = [ "*" ];
21 };
22
23 NUnit360 = fetchNuGet {
24 baseName = "NUnit";
25 version = "3.6.0";
26 sha256 = "0wz4sb0hxlajdr09r22kcy9ya79lka71w0k1jv5q2qj3d6g2frz1";
27 outputFiles = [ "*" ];
28 };
29
30in
31
32buildPythonPackage rec {
33 pname = "pythonnet";
34 version = "2.3.0";
35
36 src = fetchPypi {
37 inherit pname version;
38 sha256 = "1hxnkrfj8ark9sbamcxzd63p98vgljfvdwh79qj3ac8pqrgghq80";
39 };
40
41 postPatch = ''
42 substituteInPlace setup.py --replace 'self._install_packages()' '#self._install_packages()'
43 '';
44
45 preConfigure = ''
46 [ -z "$dontPlacateNuget" ] && placate-nuget.sh
47 [ -z "$dontPlacatePaket" ] && placate-paket.sh
48 '';
49
50 nativeBuildInputs = [
51 pytest
52 pycparser
53
54 pkgconfig
55 dotnetbuildhelpers
56 clang
57
58 NUnit360
59 UnmanagedExports127
60 ];
61
62 buildInputs = [
63 mono
64 ];
65
66 preBuild = ''
67 rm -rf packages
68 mkdir packages
69
70 ln -s ${NUnit360}/lib/dotnet/NUnit/ packages/NUnit.3.6.0
71 ln -s ${UnmanagedExports127}/lib/dotnet/NUnit/ packages/UnmanagedExports.1.2.7
72 '';
73
74 checkPhase = ''
75 ${python.interpreter} -m pytest
76 '';
77
78 meta = with lib; {
79 description = ".Net and Mono integration for Python";
80 homepage = https://pythonnet.github.io;
81 license = licenses.mit;
82 maintainers = with maintainers; [ jraygauthier ];
83 };
84}