-
-
Notifications
You must be signed in to change notification settings - Fork 346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SCons] Fix stage directory from appearing in setup_cantera #1102
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few "double checks" here, thanks @speth!
interfaces/cython/SConscript
Outdated
@@ -122,6 +123,10 @@ else: | |||
# Install Python module in the default location | |||
extra = '' | |||
|
|||
if env['stage_dir']: | |||
# Get the absolute path to the stage directory | |||
extra += ' --root=' + str(Path.cwd().parents[1].joinpath(env["stage_dir"])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is long enough to me to deserve its own variable, so it can clarify what is happening here. In particular, an example of what Path.cwd().parents[1]
should be, in a comment, would help future us remember why this is here. I have a couple of questions as well.
- Is
Path.cwd()
always guaranteed to be the directory that we want? I mean,Path.cwd()
returns the current working directory of the Python process, which is not necessarily the root of the project. I think it should be, because SCons requires the SConstruct file, but is there a more stable way to find the right path? stage_dir
may have relative path components in it, so probably best to.resolve()
the path after joining.- You can avoid the
str(...)
by using an f-string here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding (1), SCons changes the working directory such that cwd()
here is the directory containing the SConscript
file, the interfaces/cython
subdirectory of the Cantera source directory. I think that can be regarded as stable behavior.
Fixes setup_cantera and the post-install message to reference the path of the Python module on the target system rather than the staging directory. Also, generated .pyc files no long specify the path in the staging directory. This has no effect on the use of the .pyc files, but helps avoid warnings/errors from packaging system linters (notably, on FreeBSD). Fixes Cantera#1094
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good ...
Changes proposed in this pull request
python_module_loc
to remove the stage directory prefix so that doesn't show up in thesetup_cantera
script or the post-install message..pyc
files.On this second point, I'm hoping we're finally using the
--root
option tosetuptools
correctly. Previously (#296) we had tried using it in some cases and not been able to get it to do what we wanted.If applicable, fill in the issue number this pull request is fixing
Fixes #1094
If applicable, provide an example illustrating new features this pull request is introducing
Checklist
scons build
&scons test
) and unit tests address code coverage