skia2/infra/bots/recipe_modules/env/api.py
Robert Iannucci 297a7efd54 [skia] convert recipes and module to new context module
This is a syntax-only change to convert to the new (documented) context
module.

R=borenet@google.com

Bug: skia:
Change-Id: Id907c309d3cf38b85a46f6d8d7ce90ed58ba026f
Reviewed-on: https://skia-review.googlesource.com/16840
Commit-Queue: Eric Boren <borenet@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
2017-05-15 13:46:22 +00:00

21 lines
680 B
Python

# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from recipe_engine import recipe_api
class EnvApi(recipe_api.RecipeApi):
def __call__(self, env_dict):
env = self.m.context.env
# If PATH is defined in both, merge them together, merging default_env into
# path by replacing %(PATH)s
upstream_path = env.get('PATH', '')
env.update(env_dict)
my_path = env_dict.get('PATH', '')
if upstream_path and my_path and upstream_path != my_path:
env['PATH'] = upstream_path.replace(r'%(PATH)s', my_path)
return self.m.context(env=env)