feat: support passenv (#914)
* feat: support passenv * refactor: environment-pass and spaces * docs: document environment pass * Add unit test for passing through awkward env variable values * Remove unused as_shell_commands method from environment * Fix passthrough edge case by avoiding bash for passthrough assignments * Fix mypy error in test * Fix unit test * Apply suggestions from code review Co-authored-by: Joe Rickerby <joerick@mac.com>
This commit is contained in:
co-authored by
Joe Rickerby
parent
1176024473
commit
f45de3f24e
@@ -408,6 +408,7 @@ class Options:
|
||||
environment_config = self.reader.get(
|
||||
"environment", table={"item": '{k}="{v}"', "sep": " "}
|
||||
)
|
||||
environment_pass = self.reader.get("environment-pass", sep=" ").split()
|
||||
before_build = self.reader.get("before-build", sep=" && ")
|
||||
repair_command = self.reader.get("repair-wheel-command", sep=" && ")
|
||||
|
||||
@@ -438,6 +439,14 @@ class Options:
|
||||
traceback.print_exc(None, sys.stderr)
|
||||
sys.exit(2)
|
||||
|
||||
# Pass through environment variables
|
||||
if self.platform == "linux":
|
||||
for env_var_name in environment_pass:
|
||||
try:
|
||||
environment.add(env_var_name, os.environ[env_var_name])
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
if dependency_versions == "pinned":
|
||||
dependency_constraints: Optional[
|
||||
DependencyConstraints
|
||||
|
||||
Reference in New Issue
Block a user