1#!/usr/bin/env bash
2
3version="2.12.0"
4
5bucket="https://storage.googleapis.com/tensorflow"
6
7# List of binary wheels for Tensorflow. The most recent versions can be found
8# on the following page:
9# https://www.tensorflow.org/install/pip?lang=python3#package-location
10url_and_key_list=(
11"linux_py_38_cpu $bucket/linux/cpu/tensorflow_cpu-${version}-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
12"linux_py_39_cpu $bucket/linux/cpu/tensorflow_cpu-${version}-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
13"linux_py_310_cpu $bucket/linux/cpu/tensorflow_cpu-${version}-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
14"linux_py_38_gpu $bucket/linux/gpu/tensorflow-${version}-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
15"linux_py_39_gpu $bucket/linux/gpu/tensorflow-${version}-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
16"linux_py_310_gpu $bucket/linux/gpu/tensorflow-${version}-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl"
17"mac_py_38_cpu $bucket/mac/cpu/tensorflow-${version}-cp38-cp38-macosx_10_15_x86_64.whl"
18"mac_py_39_cpu $bucket/mac/cpu/tensorflow-${version}-cp39-cp39-macosx_10_15_x86_64.whl"
19"mac_py_310_cpu $bucket/mac/cpu/tensorflow-${version}-cp310-cp310-macosx_10_15_x86_64.whl"
20)
21
22hashfile=binary-hashes.nix
23rm -f $hashfile
24echo "{" >> $hashfile
25echo "version = \"$version\";" >> $hashfile
26
27for url_and_key in "${url_and_key_list[@]}"; do
28 key=$(echo "$url_and_key" | cut -d' ' -f1)
29 url=$(echo "$url_and_key" | cut -d' ' -f2)
30
31 echo "prefetching ${url}..."
32 hash=$(nix-prefetch-url $url)
33
34 echo "$key = {" >> $hashfile
35 echo " url = \"$url\";" >> $hashfile
36 echo " sha256 = \"$hash\";" >> $hashfile
37 echo "};" >> $hashfile
38
39 echo
40done
41
42echo "}" >> $hashfile
43echo "done."