rattler-build icon indicating copy to clipboard operation
rattler-build copied to clipboard

Make ${{ PREFIX }} and other "build-time" vars available in script section?

Open wolfv opened this issue 1 year ago • 2 comments

I am wondering if it would be useful to add some variables only in the script section.

Because it would make it less annoying to deal with Windows vs. Unix env vars.

E.g. this:

    - if: unix
      then:
        - cargo install --locked --root $PREFIX --path . --no-track
      else:
        - cargo install --locked --root %PREFIX% --path .  --no-track

Could be written as:

script: cargo install --locked --root ${{ PREFIX }} --path . --no-track

However, some variables introduce a "dependency" on the parsing (for example, PREFIX usually needs the package name to be available, because the directory looks something like /bld/<package-name>-<timestamp>/placeholder).

wolfv avatar May 23 '24 07:05 wolfv

Actually, it might also be nice to have ${{ PYTHON }} availalbe (which depends on ${{ PREFIX }}.

Maybe we should render this part with another Jinja context ...

wolfv avatar May 27 '24 11:05 wolfv

The reason why it's nice is that it works cross-platform regardless of the shell. Switching to deno_task_shell would also work, but not sure if that's a better solution.

wolfv avatar May 27 '24 11:05 wolfv

Apologies, the issue I tagged above may be a new issue. This was the closest similar issue I could find.

schuylermartin45 avatar Sep 20 '24 16:09 schuylermartin45

No this is fine and is the correct issue indeed! :)

wolfv avatar Sep 20 '24 16:09 wolfv

We also have a PR for it: https://github.com/prefix-dev/rattler-build/pull/894

wolfv avatar Sep 20 '24 16:09 wolfv

Initial version of this is merged!

wolfv avatar Sep 25 '24 09:09 wolfv