Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libtensorflow: 2.14.0 -> 2.15.0 #278616

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkgs/development/python-modules/keras/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ buildPythonPackage rec {
dependencies = [
absl-py
h5py
ml-dtypes
({ ml-dtypesTF = ml-dtypes; } // tensorflow).ml-dtypesTF
namex
numpy
optree
Expand Down

This file was deleted.

389 changes: 0 additions & 389 deletions pkgs/development/python-modules/tensorflow/absl_to_std.patch

This file was deleted.

12 changes: 12 additions & 0 deletions pkgs/development/python-modules/tensorflow/add-python-312.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff -Naurd x/tensorflow/tools/toolchains/python/python_repo.bzl y/tensorflow/tools/toolchains/python/python_repo.bzl
--- x/tensorflow/tools/toolchains/python/python_repo.bzl 2024-10-08 07:49:21.408314991 +0000
+++ y/tensorflow/tools/toolchains/python/python_repo.bzl 2024-10-08 07:52:22.552639011 +0000
@@ -4,7 +4,7 @@
Defaults to 3.10.
"""

-VERSIONS = ["3.9", "3.10", "3.11"]
+VERSIONS = ["3.9", "3.10", "3.11", "3.12"]
DEFAULT_VERSION = "3.10"
WARNING = """
TF_PYTHON_VERSION variable was not set correctly, using default version. {} Python
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
diff --git a/src/main/java/com/google/devtools/build/lib/exec/local/PosixLocalEnvProvider.java b/src/main/java/com/google/devtools/build/lib/exec/local/PosixLocalEnvProvider.java
index 6fff2af..7e2877e 100644
--- a/src/main/java/com/google/devtools/build/lib/exec/local/PosixLocalEnvProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/exec/local/PosixLocalEnvProvider.java
@@ -47,6 +47,16 @@ public final class PosixLocalEnvProvider implements LocalEnvProvider {
Map<String, String> env, BinTools binTools, String fallbackTmpDir) {
ImmutableMap.Builder<String, String> result = ImmutableMap.builder();
result.putAll(Maps.filterKeys(env, k -> !k.equals("TMPDIR")));
+
+ // In case we are running on NixOS.
+ // If bash is called with an unset PATH on this platform,
+ // it will set it to /no-such-path and default tools will be missings.
+ // See, https://github.com/NixOS/nixpkgs/issues/94222
+ // So we ensure that minimal dependencies are present.
+ if (!env.containsKey("PATH")){
+ result.put("PATH", "@actionsPathPatch@");
+ }
+
String p = clientEnv.get("TMPDIR");
if (Strings.isNullOrEmpty(p)) {
// Do not use `fallbackTmpDir`, use `/tmp` instead. This way if the user didn't export TMPDIR
index 95642767c6..39d3c62461 100644
--- a/src/main/java/com/google/devtools/build/lib/exec/local/XcodeLocalEnvProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/exec/local/XcodeLocalEnvProvider.java
@@ -74,6 +74,16 @@ public final class XcodeLocalEnvProvider implements LocalEnvProvider {

ImmutableMap.Builder<String, String> newEnvBuilder = ImmutableMap.builder();
newEnvBuilder.putAll(Maps.filterKeys(env, k -> !k.equals("TMPDIR")));
+
+ // In case we are running on NixOS.
+ // If bash is called with an unset PATH on this platform,
+ // it will set it to /no-such-path and default tools will be missings.
+ // See, https://github.com/NixOS/nixpkgs/issues/94222
+ // So we ensure that minimal dependencies are present.
+ if (!env.containsKey("PATH")){
+ newEnvBuilder.put("PATH", "@actionsPathPatch@");
+ }
+
String p = clientEnv.get("TMPDIR");
if (Strings.isNullOrEmpty(p)) {
// Do not use `fallbackTmpDir`, use `/tmp` instead. This way if the user didn't export TMPDIR
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
writeText,
bazel,
runLocal,
bazelTest,
distDir,
}:

# Tests that certain executables are available in bazel-executed bash shells.

let
WORKSPACE = writeText "WORKSPACE" ''
workspace(name = "our_workspace")
'';

fileIn = writeText "input.txt" ''
one
two
three
'';

fileBUILD = writeText "BUILD" ''
genrule(
name = "tool_usage",
srcs = [ ":input.txt" ],
outs = [ "output.txt" ],
cmd = "cat $(location :input.txt) | gzip - | gunzip - | awk '/t/' > $@",
)
'';

workspaceDir = runLocal "our_workspace" { } ''
mkdir $out
cp ${WORKSPACE} $out/WORKSPACE
cp ${fileIn} $out/input.txt
cp ${fileBUILD} $out/BUILD
'';

testBazel = bazelTest {
name = "bazel-test-bash-tools";
bazelPkg = bazel;
inherit workspaceDir;

bazelScript = ''
${bazel}/bin/bazel build :tool_usage --distdir=${distDir}
cp bazel-bin/output.txt $out
echo "Testing content" && [ "$(cat $out | wc -l)" == "2" ] && echo "OK"
'';
};

in
testBazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/src/main/cpp/option_processor.cc b/src/main/cpp/option_processor.cc
index 8f8f15685f..a7ae52d1e4 100644
--- a/src/main/cpp/option_processor.cc
+++ b/src/main/cpp/option_processor.cc
@@ -56,7 +56,7 @@ OptionProcessor::OptionProcessor(
: workspace_layout_(workspace_layout),
startup_options_(std::move(default_startup_options)),
parse_options_called_(false),
- system_bazelrc_path_(BAZEL_SYSTEM_BAZELRC_PATH) {}
+ system_bazelrc_path_("@bazelSystemBazelRCPath@") {}

OptionProcessor::OptionProcessor(
const WorkspaceLayout* workspace_layout,
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
bazel,
bazelTest,
bazel-examples,
stdenv,
darwin,
lib,
runLocal,
runtimeShell,
writeScript,
writeText,
distDir,
}:

let

toolsBazel = writeScript "bazel" ''
#! ${runtimeShell}

export CXX='${stdenv.cc}/bin/clang++'
export LD='${darwin.cctools}/bin/ld'
export LIBTOOL='${darwin.cctools}/bin/libtool'
export CC='${stdenv.cc}/bin/clang'

# XXX: hack for macosX, this flags disable bazel usage of xcode
# See: https://github.com/bazelbuild/bazel/issues/4231
export BAZEL_USE_CPP_ONLY_TOOLCHAIN=1

exec "$BAZEL_REAL" "$@"
'';

workspaceDir = runLocal "our_workspace" { } (
''
cp -r ${bazel-examples}/cpp-tutorial/stage3 $out
find $out -type d -exec chmod 755 {} \;
''
+ (lib.optionalString stdenv.isDarwin ''
mkdir $out/tools
cp ${toolsBazel} $out/tools/bazel
'')
);

testBazel = bazelTest {
name = "bazel-test-cpp";
inherit workspaceDir;
bazelPkg = bazel;
bazelScript =
''
${bazel}/bin/bazel \
build --verbose_failures \
--distdir=${distDir} \
--curses=no \
--sandbox_debug \
//... \
''
+ lib.optionalString (stdenv.isDarwin) ''
--cxxopt=-x --cxxopt=c++ --host_cxxopt=-x --host_cxxopt=c++ \
--linkopt=-stdlib=libc++ --host_linkopt=-stdlib=libc++ \
'';
};

in
testBazel
Loading
Loading