Loading tools/releasetools/common.py +13 −0 Original line number Diff line number Diff line Loading @@ -96,6 +96,7 @@ class Options(object): self.cache_size = None self.stash_threshold = 0.8 self.logfile = None self.host_tools = {} OPTIONS = Options() Loading Loading @@ -213,6 +214,10 @@ def InitLogging(): logging.config.dictConfig(config) def SetHostToolLocation(tool_name, location): OPTIONS.host_tools[tool_name] = location def Run(args, verbose=None, **kwargs): """Creates and returns a subprocess.Popen object. Loading @@ -234,6 +239,14 @@ def Run(args, verbose=None, **kwargs): kwargs['stderr'] = subprocess.STDOUT if 'universal_newlines' not in kwargs: kwargs['universal_newlines'] = True # If explicitly set host tool location before, use that location to avoid # PATH violation. Make a copy of args in case client relies on the content # of args later. if args and args[0] in OPTIONS.host_tools: args = args[:] args[0] = OPTIONS.host_tools[args[0]] # Don't log any if caller explicitly says so. if verbose: logger.info(" Running: \"%s\"", " ".join(args)) Loading Loading
tools/releasetools/common.py +13 −0 Original line number Diff line number Diff line Loading @@ -96,6 +96,7 @@ class Options(object): self.cache_size = None self.stash_threshold = 0.8 self.logfile = None self.host_tools = {} OPTIONS = Options() Loading Loading @@ -213,6 +214,10 @@ def InitLogging(): logging.config.dictConfig(config) def SetHostToolLocation(tool_name, location): OPTIONS.host_tools[tool_name] = location def Run(args, verbose=None, **kwargs): """Creates and returns a subprocess.Popen object. Loading @@ -234,6 +239,14 @@ def Run(args, verbose=None, **kwargs): kwargs['stderr'] = subprocess.STDOUT if 'universal_newlines' not in kwargs: kwargs['universal_newlines'] = True # If explicitly set host tool location before, use that location to avoid # PATH violation. Make a copy of args in case client relies on the content # of args later. if args and args[0] in OPTIONS.host_tools: args = args[:] args[0] = OPTIONS.host_tools[args[0]] # Don't log any if caller explicitly says so. if verbose: logger.info(" Running: \"%s\"", " ".join(args)) Loading