Bug Description
_get_env() should update os.environ instead of returning a merged dict
On Windows, passing a custom env dict to subprocess does not affect how the OS searches for the executable. This means subprocess.check_output(["cargo", "--version"], env={**os.environ, **extra_env}) fails to find cargo.exe even though the merged dict contains the correct PATH.
To fix this, I am guessing we should update os.environ in place instead of returning a merged dict:
def _get_env() -> Optional[Dict[str, str]]:
if not os.environ.get("MATURIN_NO_INSTALL_RUST") and not shutil.which("cargo"):
from puccinialin import setup_rust
print("Rust not found, installing into a temporary directory")
extra_env = setup_rust()
os.environ.update(extra_env)
return None
Related to konstin/puccinialin#16
Your maturin version (maturin --version)
1.12.6
Your Python version (python -V)
All Python versions
Your pip version (pip -V)
26.0.1
What bindings you're using
None
Does cargo build work?
If on windows, have you checked that you aren't accidentally using unix path (those with the forward slash /)?
Steps to Reproduce
name: Install
on: [push]
jobs:
install:
runs-on: windows-latest
steps:
- name: Uninstall Rust
run: rustup self uninstall -y
- name: Install GxHash
run: pip install gxhash
Workflow will fail when it should pass.
Bug Description
_get_env()should updateos.environinstead of returning a merged dictOn Windows, passing a custom
envdict tosubprocessdoes not affect how the OS searches for the executable. This meanssubprocess.check_output(["cargo", "--version"], env={**os.environ, **extra_env})fails to findcargo.exeeven though the merged dict contains the correct PATH.To fix this, I am guessing we should update
os.environin place instead of returning a merged dict:Related to konstin/puccinialin#16
Your maturin version (
maturin --version)1.12.6
Your Python version (
python -V)All Python versions
Your pip version (
pip -V)26.0.1
What bindings you're using
None
Does
cargo buildwork?If on windows, have you checked that you aren't accidentally using unix path (those with the forward slash
/)?Steps to Reproduce
Workflow will fail when it should pass.