git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #67787 from jonringer/add-python3-dotnetcore2

python3Packages.dotnetcore2: init at 2.1.8.1

commit55bed3d06299e0b4319a735b9f22f341321b1e6f authorMario Rodas <marsam@users.noreply.github.com> dateTue 24 Sep 2019, 15:58 (7 years ago) parentda9e40f4031836
3 files changed+82
pkgs/development/python-modules/dotnetcore2/default.nix+59 pkgs/development/python-modules/dotnetcore2/runtime.patch+19 pkgs/top-level/python-packages.nix+4
pkgs/development/python-modules/dotnetcore2/default.nixnew file+59
@@ -0,0 +1,59 @@
1+{ stdenv, lib, buildPythonPackage, fetchPypi, python, isPy27
2+, dotnet-sdk
3+, substituteAll
4+, distro
5+, unzip
6+}:
7+
8+buildPythonPackage rec {
9+ pname = "dotnetcore2";
10+ version = "2.1.8.1";
11+ format = "wheel";
12+ disabled = isPy27;
13+
14+ src = fetchPypi {
15+ inherit pname version format;
16+ python = "py3";
17+ platform = "manylinux1_x86_64";
18+ sha256 = "13zrff5j767d3f8drl397sjhl28winsrfa8pa20svf00xfcsy34s";
19+ };
20+
21+ nativeBuildInputs = [ unzip ];
22+
23+ propagatedBuildInputs = [ distro ];
24+
25+ # needed to apply patches
26+ prePatch = ''
27+ unzip dist/dotnet*
28+ '';
29+
30+ patches = [
31+ ( substituteAll {
32+ src = ./runtime.patch;
33+ dotnet = dotnet-sdk;
34+ }
35+ )
36+ ];
37+
38+ # unfortunately the noraml pip install fails because the manylinux1 format check fails with NixOS
39+ installPhase = ''
40+ mkdir -p $out/${python.sitePackages}/${pname}
41+ # copy metadata
42+ cp -r dotnetcore2-2* $out/${python.sitePackages}
43+ # copy non-dotnetcore related files
44+ cp -r dotnetcore2/{__init__.py,runtime.py} $out/${python.sitePackages}/${pname}
45+ '';
46+
47+ # no tests, ensure it's one useful function works
48+ checkPhase = ''
49+ ${python.interpreter} -c 'from dotnetcore2 import runtime; print(runtime.get_runtime_path())'
50+ '';
51+
52+ meta = with lib; {
53+ description = "DotNet Core runtime";
54+ homepage = "https://github.com/dotnet/core";
55+ license = licenses.mit;
56+ platforms = [ "x86_64-linux" ];
57+ maintainers = with maintainers; [ jonringer ];
58+ };
59+}
pkgs/development/python-modules/dotnetcore2/runtime.patchnew file+19
@@ -0,0 +1,19 @@
1+diff a/dotnetcore2/runtime.py b/dotnetcore2/runtime.py
2+--- a/dotnetcore2/runtime.py
3++++ b/dotnetcore2/runtime.py
4+@@ -39,13 +39,13 @@ def _get_bin_folder() -> str:
5+
6+
7+ def get_runtime_path():
8++ return "@dotnet@/dotnet"
9+ search_string = os.path.join(_get_bin_folder(), 'dotnet*')
10+ matches = [f for f in glob.glob(search_string, recursive=True)]
11+ return matches[0]
12+
13+ def ensure_dependencies() -> Optional[str]:
14+- if dist is None:
15+- return None
16++ return None
17+
18+ bin_folder = _get_bin_folder()
19+ deps_path = os.path.join(bin_folder, 'deps')
pkgs/top-level/python-packages.nix+4
@@ -523,6 +523,10 @@ in {
523523
524524 dominate = callPackage ../development/python-modules/dominate { };
525525
526+ dotnetcore2 = callPackage ../development/python-modules/dotnetcore2 {
527+ inherit (pkgs) substituteAll dotnet-sdk;
528+ };
529+
526530 emcee = callPackage ../development/python-modules/emcee { };
527531
528532 emailthreads = callPackage ../development/python-modules/emailthreads { };