As far as I can tell, BasePlugin has one method for manipulating environment variables: the env() method.
I have a custom plugin where I need to be able to set certain environment variables at build-time, so I'm setting them in this method like so:
```
def env(self, root):
env = super().env(root)
env.extend([
'CPPFLAGS="-std=c++11 -I{} $CPPFLAGS"'.format(os.path.join(
root, 'usr', 'include')),
'CFLAGS="-std=c11 -I{} $CFLAGS"'.format(os.path.join(
root, 'usr', 'include')),
])
return env
```
This works fine for building the snap, but I notice that these environment variables are then present in the command wrapper as well, so they're also being set for runtime. Most of the time this won't be a massive issue - setting CPPFLAGS has no effect at run-time, but it's a little surprising, and I can imagine situations where plugin authors will want more control over what's set at build time, and what's set at run-time.
Can you look at the godeps plugin? That has a better mechanism for this. Then `env` method is mostly there for runtime bits only.
Keep in mind we are also going to allow parts to set `environment` and `build-environment` with those keywords allowing more flexibility from a part author point of view (and in some cases avoiding to write a new plugin).