git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #63809 from timokau/dm-sonnet-1.33

python.pkgs.dm-sonnet: 1.30 -> 1.33

commit63e15d588a2b0a280b04ee14b65ef3b8e7a92c2d authorTimo Kaufmann <timokau@zoho.com> dateTue 2 Jul 2019, 11:19 (7 years ago) parent84708a879c5510
3 files changed+63−13
pkgs/build-support/build-bazel-package/default.nix+6−4 pkgs/development/python-modules/dm-sonnet/default.nix+2−2 pkgs/development/python-modules/tensorflow-probability/default.nix+55−7
pkgs/build-support/build-bazel-package/default.nix+6−4
@@ -51,8 +51,10 @@ in stdenv.mkDerivation (fBuildAttrs // {
5151 rm -rf $bazelOut/external/{local_*,\@local_*}
5252
5353 # Patching markers to make them deterministic
54− sed -i 's, -\?[0-9][0-9]*$, 1,' $bazelOut/external/\@*.marker
55− sed -i '/^ENV:TMP.*/d' $bazelOut/external/\@*.marker
54+ find $bazelOut/external -name '@*\.marker' -exec sed -i \
55+ -e 's, -\?[0-9][0-9]*$, 1,' \
56+ -e '/^ENV:TMP.*/d' \
57+ '{}' \;
5658
5759 # Remove all vcs files
5860 rm -rf $(find $bazelOut/external -type d -name .git)
@@ -86,8 +88,8 @@ in stdenv.mkDerivation (fBuildAttrs // {
8688 '';
8789
8890 preConfigure = ''
89− mkdir -p $bazelOut/external
90− cp -r $deps/* $bazelOut/external
91+ mkdir -p "$bazelOut"
92+ cp -r $deps $bazelOut/external
9193 chmod -R +w $bazelOut
9294 find $bazelOut -type l | while read symlink; do
9395 ln -sf $(readlink "$symlink" | sed "s,NIX_BUILD_TOP,$NIX_BUILD_TOP,") "$symlink"
pkgs/development/python-modules/dm-sonnet/default.nix+2−2
@@ -15,7 +15,7 @@
1515}:
1616
1717let
18− version = "1.30";
18+ version = "1.33";
1919
2020 # first build all binaries and generate setup.py using bazel
2121 bazel-build = buildBazelPackage rec {
@@ -25,7 +25,7 @@ let
2525 owner = "deepmind";
2626 repo = "sonnet";
2727 rev = "v${version}";
28− sha256 = "1dli4a4arx2gmb4p676pfibvnpag9f13znisrk9381g7xpqqmaw6";
28+ sha256 = "1nqsja1s8jrkq6v1whgh7smk17313mjr9vs3k5c1m8px4yblzhqc";
2929 };
3030
3131 nativeBuildInputs = [
pkgs/development/python-modules/tensorflow-probability/default.nix+55−7
@@ -1,8 +1,13 @@
11{ lib
22, fetchFromGitHub
3+, buildBazelPackage
34, buildPythonPackage
45, python
6+, setuptools
7+, wheel
58, tensorflow
9+, six
10+, numpy
611, decorator
712, cloudpickle
813, hypothesis
@@ -12,19 +17,62 @@
1217, pytest
1318}:
1419
15−buildPythonPackage rec {
16− pname = "tensorflow-probability";
20+let
1721 version = "0.7";
22+ pname = "tensorflow_probability";
1823
19− src = fetchFromGitHub {
20− owner = "tensorflow";
21− repo = "probability";
22− rev = "v${version}";
23− sha256 = "0sy9gmjcvmwciamqvd7kd9qw2wd7ksklk80815fsn7sj0wiqxjyd";
24+ # first build all binaries and generate setup.py using bazel
25+ bazel-wheel = buildBazelPackage {
26+ name = "${pname}-${version}-py2.py3-none-any.whl";
27+
28+ src = fetchFromGitHub {
29+ owner = "tensorflow";
30+ repo = "probability";
31+ rev = "v${version}";
32+ sha256 = "0sy9gmjcvmwciamqvd7kd9qw2wd7ksklk80815fsn7sj0wiqxjyd";
33+ };
34+
35+ nativeBuildInputs = [
36+ # needed to create the output wheel in installPhase
37+ python
38+ setuptools
39+ wheel
40+ ];
41+
42+ bazelTarget = ":pip_pkg";
43+
44+ fetchAttrs = {
45+ sha256 = "0sjjj9z1dhilhpc8pq4154czrb79z9cm044jvn75kxcjv6v5l2m5";
46+ };
47+
48+ buildAttrs = {
49+ preBuild = ''
50+ patchShebangs .
51+ '';
52+
53+ installPhase = ''
54+ # work around timestamp issues
55+ # https://github.com/NixOS/nixpkgs/issues/270#issuecomment-467583872
56+ export SOURCE_DATE_EPOCH=315532800
57+
58+ # First build, then move. Otherwise pip_pkg would create the dir $out
59+ # and then put the wheel in that directory. However we want $out to
60+ # point directly to the wheel file.
61+ ./bazel-bin/pip_pkg . --release
62+ mv *.whl "$out"
63+ '';
64+ };
2465 };
66+in buildPythonPackage rec {
67+ inherit version pname;
68+ format = "wheel";
69+
70+ src = bazel-wheel;
2571
2672 propagatedBuildInputs = [
2773 tensorflow
74+ six
75+ numpy
2876 decorator
2977 cloudpickle
3078 ];