Skip to content

CARGO_BUILD_TARGET in setup.py

The rust package in conda-forge uses CARGO_BUILD_TARGET (https://doc.rust-lang.org/cargo/reference/environment-variables.html). I had to patch Mercurial's setup.py to use Rust for the conda-forge package (https://github.com/conda-forge/mercurial-feedstock/pull/59/files#diff-d7075654874cb08007a21aaab3ecd4b3453a9087e7505d034d548b8938b599bcR6).

I propose a change that would avoid this patch. I tried to have the smallest change possible to have the right path with and without CARGO_BUILD_TARGET. Note that without CARGO_BUILD_TARGET, this gives:

In [2]: os.path.join(
   ...:         'rust', 'target', os.environ.get('CARGO_BUILD_TARGET', ''), 'release'
   ...:     )
Out[2]: 'rust/target/release'

Merge request reports