← Back to issue list

no way to differentiate between build-time and run-time env vars in plugins

View original Launchpad issue

Metadata

Project
snapcraft
Number
#1600035
Type
issue
State
open
Author
~thomir-deactivatedaccount
Labels
Created
2016-07-07 22:31:44.675810+00:00
Updated
2019-01-28 15:14:22.312494+00:00
Closed

Current evaluation

No evaluation has been recorded for this issue yet.

Issue body

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.

Evaluation history

No evaluation history available.