I'd like to have pants propagate the `ARCHFLAGS` e...
# development
e
I'd like to have pants propagate the
ARCHFLAGS
env var to tests for ci. This appears to require a code change to expand the hardcoded
SETTABLE_ENV_VARS
list in
src/python/pants/core/util_rules/subprocess_environment.py
. Is that true or am I missing some other way? If it is true is that viewed as good or necessary? It seems I should be able to allow any env var through I want if I go through the effort to set the option.
h
Yep, that is unfortunately true. Not only that, but we don't consistently mixin that subsystem to every
Process
I think we probably need to loose it and use a blocklist approach, e.g. block
PATH
e
I'm even fine with allowlisting, its just a pretty bad experience to be told you can't.
I certainly don't want to add a weird env var like ARCHFLAGS to a hardcoded list in Pants core either.
h
Another awkward thing is
[python-natiev-code].{cpp,ld}_flags
, which should instead move to
subprocess_environment
. I tried doing that two months ago but couldn't figure out how to deprecate cleanly and moved on to bigger priorities 🤷‍♂️
h
Yes, that was my bad idea I think
we should get rid of it
h
I'm even fine with allowlisting, its just a pretty bad experience to be told you can't.
To be clear, I meant that Pants's code should blocklist. Users will still allowlist via the option
e
K. Great. I'll start small and kill the list constraint.
w
hm... you said you want the flag passed to “tests”?
there is a setting specific to the
test
goal. the env var won’t go to pex compilation (which is what the subprocess environment is for, afaik)
h
psutil is failing to be built in one of John's PRs. I didn't check if that's happening inside a test vs. in the setup, but it does speak to a plausible scenario where a user can't resolve requirements like psutil until we fix Pants's hardcoded list, which is pretty bad
e
I'm not exatly sure where to fix this. I'm trying the SubprocessEnvironment kill allowlist 1st.
Since it sounds like folks agree that should go anyhow.
w
yea. multiple levels of filtering in play here.
outside of a test, you’d only need to expose it in the subprocess environment. inside of a test you’d additionally need the env var to be in the test sandbox at all (which is the bit i linked.)
h
yeah, to recap, three sins right now with our arbitrary env var code: 1. you can only set for a blessed subset. John is fixing this 2. not every Process is wired to use this, including things like running Protoc. 3.
[python-native-code]
should merge into
[subprocess-environment]
this is a good first step
w
2. not every Process is wired to use this, including things like running Protoc.
3. 
[python-native-code]
 should merge into 
[subprocess-environment]
um, maybe. it’s also possible that they should be split out and be specific, rather than all being unified. this was a usecase for “scoped” Subsystems
đź‘Ť 1
so you could have a root setting which applied to all of them, and then extend it in specific instances
đź‘Ť 1