@@ -430,14 +430,10 @@ def get_system_libs(self):
430
430
431
431
def setup_build_dirs (self ):
432
432
"""Setup temporary build directories"""
433
- # Tensorflow/Bazel needs a couple of directories where it stores build cache and artefacts
434
- tmpdir = tempfile .mkdtemp (suffix = '-bazel-tf' , dir = self .builddir )
435
- self .output_root_dir = os .path .join (tmpdir , 'output_root' )
436
- self .output_base_dir = os .path .join (tmpdir , 'output_base' )
437
- self .output_user_root_dir = os .path .join (tmpdir , 'output_user_root' )
438
- self .wrapper_dir = os .path .join (tmpdir , 'wrapper_bin' )
439
- # This (likely) needs to be a subdir of output_base
440
- self .install_base_dir = os .path .join (self .output_base_dir , 'inst_base' )
433
+ # Path where Bazel will store its output, build artefacts etc.
434
+ self .output_user_root_dir = tempfile .mkdtemp (suffix = '-bazel-tf' , dir = self .builddir )
435
+ # Folder where wrapper binaries can be placed, where required. TODO: Replace by --action_env cmds
436
+ self .wrapper_dir = tempfile .mkdtemp (suffix = '-wrapper_bin' , dir = self .builddir )
441
437
442
438
def configure_step (self ):
443
439
"""Custom configuration procedure for TensorFlow."""
@@ -640,17 +636,14 @@ def configure_step(self):
640
636
for (key , val ) in sorted (config_env_vars .items ()):
641
637
env .setvar (key , val )
642
638
643
- # Does no longer apply (and might not be required at all) since 1.12.0
644
- if LooseVersion ( self . version ) < LooseVersion ( '1.12.0' ):
645
- # patch configure.py (called by configure script) to avoid that Bazel abuses $HOME/.cache/bazel
646
- regex_subs = [( r"(run_shell\(\['bazel')" ,
647
- r"\1, '--output_base=%s ', '--install_base=%s'" % ( self . output_base_dir ,
648
- self .install_base_dir ) )]
639
+ # configure.py (called by configure script) already calls bazel to determine the bazel version
640
+ # Since 2.3.0 `bazel -- version` is used which doesn't extract bazel, prior it did
641
+ # Hence make sure it doesn't extract into $HOME/.cache/bazel
642
+ if LooseVersion ( self . version ) < LooseVersion ( '2.3.0' ):
643
+ regex_subs = [( r"('bazel ', '--batch')" ,
644
+ r"\1, '--output_user_root=%s'" % self .output_user_root_dir )]
649
645
apply_regex_substitutions ('configure.py' , regex_subs )
650
646
651
- # Tell Bazel to not use $HOME/.cache/bazel at all
652
- # See https://docs.bazel.build/versions/master/output_directories.html
653
- env .setvar ('TEST_TMPDIR' , self .output_root_dir )
654
647
cmd = self .cfg ['preconfigopts' ] + './configure ' + self .cfg ['configopts' ]
655
648
run_cmd (cmd , log_all = True , simple = True )
656
649
@@ -733,8 +726,6 @@ def build_step(self):
733
726
734
727
# Options passed to the bazel command
735
728
self .bazel_opts = [
736
- '--output_base=%s' % self .output_base_dir ,
737
- '--install_base=%s' % self .install_base_dir ,
738
729
'--output_user_root=%s' % self .output_user_root_dir ,
739
730
]
740
731
jvm_max_memory = self .cfg ['jvm_max_memory' ]
0 commit comments