Fix zipfile path for MacOS builds.
authorMichael Case <mikecase@google.com>
Wed, 21 Mar 2018 17:26:49 +0000 (10:26 -0700)
committerTensorFlower Gardener <gardener@tensorflow.org>
Wed, 21 Mar 2018 17:29:14 +0000 (10:29 -0700)
For some reason, the zipfile module on Macs appears to work differently and
complains about the whl file we are trying to extract not being found.

PiperOrigin-RevId: 189928007

tensorflow/tools/ci_build/copy_binary.py

index b5a282b..420d390 100755 (executable)
@@ -60,7 +60,7 @@ def copy_binary(directory, origin_tag, new_tag, version, gpu=False):
     package = "tf_nightly"
   origin_binary = BINARY_STRING_TEMPLATE % (package, version, origin_tag)
   new_binary = BINARY_STRING_TEMPLATE % (package, version, new_tag)
-  zip_ref = zipfile.ZipFile(directory + origin_binary, "r")
+  zip_ref = zipfile.ZipFile(os.path.join(directory, origin_binary), "r")
 
   try:
     tmpdir = tempfile.mkdtemp()
@@ -115,6 +115,7 @@ def main():
   args = parser.parse_args()
 
   # Argument checking
+  args.filename = os.path.abspath(args.filename)
   check_existence(args.filename)
   regex_groups = re.search(TF_NIGHTLY_REGEX, args.filename)
   directory = regex_groups.group(1)