AcademySoftwareFoundation / AcademySoftwareFoundation/rez

Custom build command fail if environment variables are given

Open
#520 0 comments 0 reactions 0 assignees View on GitHub
bug rez-build
Dominant language
Python
Stars
1.1k
Forks
369
Avg merge
12d 3h
Merged PRs (30d)
5

Description

Given a package.py that includes environment variables:
~~~sh
build_command = "bash {root}/build.sh {install} ${REZ_BUILD_INSTALL_PATH}"
~~~
... the build will fail:
~~~
File "/rez/lib/python2.7/site-packages/rez-2.13.1.tbe1-py2.7.eg
g/rezplugins/build_system/custom.py", line 116, in expand
return txt.format(root=root, install=install_).strip()
KeyError: 'REZ_BUILD_INSTALL_PATH'
~~~

The reason is that the default formatter to replace root and install treats the environment variable as format key which don't have matching parameters.

### Suggested fix
Maybe it should be replaced with a (custom) formatter that ignores non-exiting keys.

### Workaround
for now redirect to a bash script which has immediate access to to environment/

### Side-note
In my tests I also failed to properly expand just given $REZ_BUILD_INSTALL_PATH (without `{}`). This time however the formatter did not complain. I have to verify this.

### Discussion for reference
https://groups.google.com/forum/#!topic/rez-config/d766K7gZOUs

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.