[recipes] Add env recipe module

Simplifies the process of nesting environments. Usage:

with api.env({'myvar': 'myval'}):
  # do stuff

Same as api.step.context but specialized for just environment and merges
PATH variable intelligently.

Bug: skia:6473
Change-Id: I5769c69cbbbcdab0c6298cee6c5e1fe9caf89c78
Reviewed-on: https://skia-review.googlesource.com/14189
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Eric Boren <borenet@google.com>
diff --git a/infra/bots/recipes/test.py b/infra/bots/recipes/test.py
index 5a21bd6..8625b11 100644
--- a/infra/bots/recipes/test.py
+++ b/infra/bots/recipes/test.py
@@ -9,6 +9,8 @@
 DEPS = [
   'build/file',
   'core',
+  'env',
+  'flavor',
   'recipe_engine/json',
   'recipe_engine/path',
   'recipe_engine/platform',
@@ -16,7 +18,6 @@
   'recipe_engine/python',
   'recipe_engine/raw_io',
   'recipe_engine/step',
-  'flavor',
   'run',
   'vars',
 ]
@@ -647,7 +648,7 @@
     args.append(skip_flag)
   args.extend(dm_flags(api.vars.builder_name))
 
-  env = api.step.get_from_context('env', {})
+  env = {}
   if 'Ubuntu16' in api.vars.builder_name:
     # The vulkan in this asset name simply means that the graphics driver
     # supports Vulkan. It is also the driver used for GL code.
@@ -677,7 +678,7 @@
   if '_PreAbandonGpuContext' in api.vars.builder_cfg.get('extra_config', ''):
     args.append('--preAbandonGpuContext')
 
-  with api.step.context({'env': env}):
+  with api.env(env):
     api.run(api.flavor.step, 'dm', cmd=args, abort_on_failure=False)
 
   if api.vars.upload_dm_results: