Set cargo cache for after env setup

Also set cargo cache for after env setup since PyOxidizer also
uses cargo.

Bug: 67
Change-Id: I0ef1d7ed178aa3dd58bc1e7814ed4837f51f2e5f
diff --git a/pw_env_setup/py/pw_env_setup/cargo_setup/__init__.py b/pw_env_setup/py/pw_env_setup/cargo_setup/__init__.py
index 101d2f3..b596b75 100644
--- a/pw_env_setup/py/pw_env_setup/cargo_setup/__init__.py
+++ b/pw_env_setup/py/pw_env_setup/cargo_setup/__init__.py
@@ -25,6 +25,9 @@
     # being in PATH.
     env.prepend('PATH', os.path.join(prefix, 'bin'))
 
+    if 'CARGO_TARGET_DIR' not in os.environ:
+        env.set('CARGO_TARGET_DIR', os.path.expanduser('~/.cargo-cache'))
+
     # packages.txt contains packages one per line with two fields: package
     # name and version.
     package_path = os.path.join(pw_root, 'pw_env_setup', 'py', 'pw_env_setup',
@@ -49,10 +52,4 @@
 
             print(' '.join(cmd))
 
-            subenv = None
-            if 'CARGO_TARGET_DIR' not in os.environ:
-                subenv = os.environ.copy()
-                subenv['CARGO_TARGET_DIR'] = os.path.expanduser(
-                    '~/.cargo-cache')
-
-            subprocess.check_call(cmd, env=subenv)
+            subprocess.check_call(cmd)