summary refs log tree commit diff
diff options
context:
space:
mode:
authorRaymond Gauthier <jraygauthier@gmail.com>2018-02-05 16:58:25 -0500
committerRaymond Gauthier <jraygauthier@gmail.com>2018-02-08 21:29:36 -0500
commit1d1209381a04594678694b2d32723fce68de4910 (patch)
tree86e0411b51f3dd15e2e65cfe0793454033daa097
parent78a17f5765f24ae24ee87224dad16862451295d2 (diff)
downloadnixlib-1d1209381a04594678694b2d32723fce68de4910.tar
nixlib-1d1209381a04594678694b2d32723fce68de4910.tar.gz
nixlib-1d1209381a04594678694b2d32723fce68de4910.tar.bz2
nixlib-1d1209381a04594678694b2d32723fce68de4910.tar.lz
nixlib-1d1209381a04594678694b2d32723fce68de4910.tar.xz
nixlib-1d1209381a04594678694b2d32723fce68de4910.tar.zst
nixlib-1d1209381a04594678694b2d32723fce68de4910.zip
pythonnet: Init at 2.3.0
-rw-r--r--pkgs/development/python-modules/pythonnet/default.nix84
-rw-r--r--pkgs/top-level/python-packages.nix5
2 files changed, 89 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/pythonnet/default.nix b/pkgs/development/python-modules/pythonnet/default.nix
new file mode 100644
index 000000000000..98f714c8d538
--- /dev/null
+++ b/pkgs/development/python-modules/pythonnet/default.nix
@@ -0,0 +1,84 @@
+{ lib
+, fetchPypi
+, fetchNuGet
+, buildPythonPackage
+, python
+, pytest
+, pycparser
+, pkgconfig
+, dotnetbuildhelpers
+, clang
+, mono
+}:
+
+let
+
+  UnmanagedExports127 = fetchNuGet {
+    baseName = "UnmanagedExports";
+    version = "1.2.7";
+    sha256 = "0bfrhpmq556p0swd9ssapw4f2aafmgp930jgf00sy89hzg2bfijf";
+    outputFiles = [ "*" ];
+  };
+
+  NUnit360 = fetchNuGet {
+    baseName = "NUnit";
+    version = "3.6.0";
+    sha256 = "0wz4sb0hxlajdr09r22kcy9ya79lka71w0k1jv5q2qj3d6g2frz1";
+    outputFiles = [ "*" ];
+  };
+
+in
+
+buildPythonPackage rec {
+  pname = "pythonnet";
+  version = "2.3.0";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "1hxnkrfj8ark9sbamcxzd63p98vgljfvdwh79qj3ac8pqrgghq80";
+  };
+
+  postPatch = ''
+    substituteInPlace setup.py --replace 'self._install_packages()' '#self._install_packages()'
+  '';
+
+  preConfigure = ''
+    [ -z "$dontPlacateNuget" ] && placate-nuget.sh
+    [ -z "$dontPlacatePaket" ] && placate-paket.sh
+  '';
+
+  nativeBuildInputs = [
+    pytest
+    pycparser
+
+    pkgconfig
+    dotnetbuildhelpers
+    clang
+
+    NUnit360
+    UnmanagedExports127
+  ];
+
+  buildInputs = [
+    mono
+  ];
+
+  preBuild = ''
+    rm -rf packages
+    mkdir packages
+
+    ln -s ${NUnit360}/lib/dotnet/NUnit/ packages/NUnit.3.6.0
+    ln -s ${UnmanagedExports127}/lib/dotnet/NUnit/ packages/UnmanagedExports.1.2.7
+  '';
+
+  checkPhase = ''
+    ${python.interpreter} -m pytest
+  '';
+
+  meta = with lib; {
+    description = ".Net and Mono integration for Python";
+    homepage = https://pythonnet.github.io;
+    license = licenses.mit;
+    maintainers = with maintainers; [ jraygauthier ];
+  };
+}
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index b36407936127..ca0acaa69057 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -14845,6 +14845,11 @@ in {
     };
   };
 
+  pythonnet = callPackage ../development/python-modules/pythonnet {
+    # `mono >= 4.6` required to prevent crashes encountered with earlier versions.
+    mono = pkgs.mono46;
+  };
+
   pytz = callPackage ../development/python-modules/pytz { };
 
   pytzdata = callPackage ../development/python-modules/pytzdata { };