Added some options for compatibility with brew and uv.#79
Conversation
…ey want to use uv pip to install pyoptsparse. Existing values for compiler options (CC, FC, CXX) will no longer be overridden if already set by the user. This was necessary for compatibility with brew compilers on MacOS.
…they set the pip-cmd to `uv pip`.
swryan
left a comment
There was a problem hiding this comment.
Should really add a job to the test matrix that builds the env with uv..
I can do that.
| os.environ['FC'] = 'ifort' | ||
| os.environ.get('CC', 'icc') | ||
| os.environ.get('CXX', 'icpc') | ||
| os.environ.get('FC', 'ifort') |
There was a problem hiding this comment.
did you mean these to be something like os.environ.set('CC', os.environ.get('CC', 'icc'))?
There was a problem hiding this comment.
No the intent here was to not override the user's environment variables if they had set them.
On an arm Mac using homebrew, gcc will just point to the nominal mac gcc, but I need one in /opt/homebrew/bin.
I could set those environment variables, but then the script was just overriding them.
There was a problem hiding this comment.
but I don't see that these gets are doing anything at all...
what you are describing is what I was trying to express above.. only set a new value for the var if it is not already set (could be done better as a conditional...)
There was a problem hiding this comment.
Brain issues...fixed :)
Summary
Existing values for compiler options (CC, FC, CXX) will no longer be overridden if already set by the user. This was necessary for compatibility with brew compilers on MacOS.
Added --pip-cmd option. If the user specifies --pip-cmd="uv pip", uv will be used to install the package. This is necessary for users who use uv for their environment management.
Related Issues
Backwards incompatibilities
None
New Dependencies
None