aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMario Rodas <marsam@users.noreply.github.com>2019-09-24 15:58:36 -0500
committerGitHub <noreply@github.com>2019-09-24 15:58:36 -0500
commit55bed3d06299e0b4319a735b9f22f341321b1e6f (patch)
tree1016489034a1288f132da43d76a1a06123335596
parentda9e40fcc299adbaeb0f2b0198dafaaf70e54b0d (diff)
parent40318362ebe957624c6d7dc02760c3719cebfecc (diff)
Merge pull request #67787 from jonringer/add-python3-dotnetcore2
python3Packages.dotnetcore2: init at 2.1.8.1
-rw-r--r--pkgs/development/python-modules/dotnetcore2/default.nix59
-rw-r--r--pkgs/development/python-modules/dotnetcore2/runtime.patch19
-rw-r--r--pkgs/top-level/python-packages.nix4
3 files changed, 82 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/dotnetcore2/default.nix b/pkgs/development/python-modules/dotnetcore2/default.nix
new file mode 100644
index 00000000000..caafeb54740
--- /dev/null
+++ b/pkgs/development/python-modules/dotnetcore2/default.nix
@@ -0,0 +1,59 @@
+{ stdenv, lib, buildPythonPackage, fetchPypi, python, isPy27
+, dotnet-sdk
+, substituteAll
+, distro
+, unzip
+}:
+
+buildPythonPackage rec {
+ pname = "dotnetcore2";
+ version = "2.1.8.1";
+ format = "wheel";
+ disabled = isPy27;
+
+ src = fetchPypi {
+ inherit pname version format;
+ python = "py3";
+ platform = "manylinux1_x86_64";
+ sha256 = "13zrff5j767d3f8drl397sjhl28winsrfa8pa20svf00xfcsy34s";
+ };
+
+ nativeBuildInputs = [ unzip ];
+
+ propagatedBuildInputs = [ distro ];
+
+ # needed to apply patches
+ prePatch = ''
+ unzip dist/dotnet*
+ '';
+
+ patches = [
+ ( substituteAll {
+ src = ./runtime.patch;
+ dotnet = dotnet-sdk;
+ }
+ )
+ ];
+
+ # unfortunately the noraml pip install fails because the manylinux1 format check fails with NixOS
+ installPhase = ''
+ mkdir -p $out/${python.sitePackages}/${pname}
+ # copy metadata
+ cp -r dotnetcore2-2* $out/${python.sitePackages}
+ # copy non-dotnetcore related files
+ cp -r dotnetcore2/{__init__.py,runtime.py} $out/${python.sitePackages}/${pname}
+ '';
+
+ # no tests, ensure it's one useful function works
+ checkPhase = ''
+ ${python.interpreter} -c 'from dotnetcore2 import runtime; print(runtime.get_runtime_path())'
+ '';
+
+ meta = with lib; {
+ description = "DotNet Core runtime";
+ homepage = "https://github.com/dotnet/core";
+ license = licenses.mit;
+ platforms = [ "x86_64-linux" ];
+ maintainers = with maintainers; [ jonringer ];
+ };
+}
diff --git a/pkgs/development/python-modules/dotnetcore2/runtime.patch b/pkgs/development/python-modules/dotnetcore2/runtime.patch
new file mode 100644
index 00000000000..54322087a78
--- /dev/null
+++ b/pkgs/development/python-modules/dotnetcore2/runtime.patch
@@ -0,0 +1,19 @@
+diff a/dotnetcore2/runtime.py b/dotnetcore2/runtime.py
+--- a/dotnetcore2/runtime.py
++++ b/dotnetcore2/runtime.py
+@@ -39,13 +39,13 @@ def _get_bin_folder() -> str:
+
+
+ def get_runtime_path():
++ return "@dotnet@/dotnet"
+ search_string = os.path.join(_get_bin_folder(), 'dotnet*')
+ matches = [f for f in glob.glob(search_string, recursive=True)]
+ return matches[0]
+
+ def ensure_dependencies() -> Optional[str]:
+- if dist is None:
+- return None
++ return None
+
+ bin_folder = _get_bin_folder()
+ deps_path = os.path.join(bin_folder, 'deps')
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 654f1c50f40..0c155424463 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -523,6 +523,10 @@ in {
dominate = callPackage ../development/python-modules/dominate { };
+ dotnetcore2 = callPackage ../development/python-modules/dotnetcore2 {
+ inherit (pkgs) substituteAll dotnet-sdk;
+ };
+
emcee = callPackage ../development/python-modules/emcee { };
emailthreads = callPackage ../development/python-modules/emailthreads { };