From b824e5ee2ec3aea7bb5d1c96f21cb223ad861fa1 Mon Sep 17 00:00:00 2001 From: Logan Hanks Date: Fri, 16 Jun 2017 10:55:21 -0700 Subject: [PATCH] Fix glob in bower2bazel.py This fixes I850271bb1c657a5ffe77946a6beaf54a3680af75. Change-Id: I128ae1b88adc267b0f1f9b1db7b0a96a87a861b3 (cherry picked from commit 9ffd58a82b497dbdfcf73945dea240469fee3b14) --- tools/js/bower2bazel.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/js/bower2bazel.py b/tools/js/bower2bazel.py index 745a7dea12..1f0cadd157 100755 --- a/tools/js/bower2bazel.py +++ b/tools/js/bower2bazel.py @@ -76,11 +76,10 @@ def build_bower_json(version_targets, seeds): seeds = set(seeds) for v in version_targets: - try: - fn = os.path.join("bazel-out/local-fastbuild/bin", v.lstrip("/").replace(":", "/")) - except: - fn = os.path.join("bazel-out/darwin_x86_64-fastbuild/bin", v.lstrip("/").replace(":", "/")) - with open(fn) as f: + path = os.path.join("bazel-out/*-fastbuild/bin", v.lstrip("/").replace(":", "/")) + fs = glob.glob(path) + assert len(fs) == 1, '%s: file not found or multiple files found: %s' % (path, fs) + with open(fs[0]) as f: j = json.load(f) if "" in j: # drop dummy entries.