Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Unified Diff: tools/mb/mb.py

Issue 1204793002: Fix errors in MB when run for the first time on a new builder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: patch for review Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/mb/mb_unittest.py » ('j') | tools/mb/mb_unittest.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/mb/mb.py
diff --git a/tools/mb/mb.py b/tools/mb/mb.py
index 5b43c61d5fda47cd73a10b6ecc30b4b1306e4483..35c0e9124fd6ab70b40947ff7fe0650207e6d086 100755
--- a/tools/mb/mb.py
+++ b/tools/mb/mb.py
@@ -13,6 +13,7 @@ from __future__ import print_function
import argparse
import ast
+import errno
import json
import os
import pipes
@@ -339,6 +340,10 @@ class MetaBuildWrapper(object):
gn_labels.append(ninja_targets_to_labels[target])
gn_runtime_deps_path = self.ToAbsPath(path, 'runtime_deps')
+
+ # Since GN hasn't run yet, the build directory may not even exist.
+ self.MaybeMakeDirectory(self.ToAbsPath(path))
+
self.WriteFile(gn_runtime_deps_path, '\n'.join(gn_labels) + '\n')
cmd.append('--runtime-deps-list-file=%s' % gn_runtime_deps_path)
@@ -738,6 +743,13 @@ class MetaBuildWrapper(object):
# This function largely exists so it can be overridden for testing.
return os.path.exists(path)
+ def MaybeMakeDirectory(self, path):
+ try:
+ os.makedirs(path)
+ except OSError, e:
+ if e.errno != errno.EEXIST:
+ raise
+
def ReadFile(self, path):
# This function largely exists so it can be overriden for testing.
with open(path) as fp:
« no previous file with comments | « no previous file | tools/mb/mb_unittest.py » ('j') | tools/mb/mb_unittest.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698