-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
Fix the shebang in certain scripts #192
Conversation
Hi! This is the friendly automated conda-forge-linting service. I just wanted to let you know that I linted all conda-recipes in your PR ( |
recipe/meta.yaml
Outdated
- head -n 1 ${PREFIX}/bin/glib-mkenums | grep -E "(${PREFIX}|/usr/bin/env python)" # [unix] | ||
- head -n 1 ${PREFIX}/bin/glib-genmarshal | grep -E "(${PREFIX}|/usr/bin/env python)" # [unix] | ||
- head -n 1 ${PREFIX}/bin/gtester-report | grep -E "(${PREFIX}|/usr/bin/env python)" # [unix] |
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.
So i don't really understand why or how this became /usr/bin/env instead of the ${PREFIX}...
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.
maybe it is a detail with how noarch python works?
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.
It's because it's supposed to point to the environment Python when installed instead of some strange prefix only used during build, but I don't know the internal mechanism Conda uses to replace it to /usr/bin/env python
.
@hmaarrfk Any news? Downstream, the only solution is to pin, which is pretty dirty. |
I think this is a step in the right direction. |
but honestly, i don't really want want to maintain the "g" software stack too much, so I want some of the maintainers to chime in with quick review before merging. |
recipe/meta.yaml
Outdated
@@ -205,6 +216,12 @@ outputs: | |||
- test -f ${PREFIX}/lib/libglib-2.0${SHLIB_EXT} # [unix] | |||
- glib-compile-resources --help | |||
- gobject-query --help | |||
# I'm not sure why the PREFIX ends up becoming the /usr/bin/env python |
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.
Shebang's can't be longer than 80 lines, so conda fixes them for you.
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.
ah i see. Thanks!
In this case, is the test correct, or should it be made stricter? (i.e. only testing for /usr/bin/env python)?
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.
Hmm ... did you check whether these tests fail if you don't apply the shebang fix? I am pretty sure that if the shebang line in the source file had $BUILD_PREFIX
in it, the test would indeed fail, because Conda's prefix-rewriting logic wouldn't be activated at all.
If that's the case, then I think the test is fine as-is. I believe that in all of our build environments, the package test is run inside a directory that's got a sufficiently long absolute path that the /usr/bin/env replacement will always be active. But if you build this recipe outside of the conda-forge framework, the test prefix could conceivably be something like /c/conda-bld/glib-123556890/_test_env
where the rewriting would not kick in.
Isuru's diagnosis is 100% correct, I believe, so it might be good to update the comment and add a link to this pull request.
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.
ok lets test the tests. I think they worked in the past. but i forget.
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.
well my tests fail to actually catch the error, but these replacements are necessary:
+ head -n 1 /home/conda/feedstock_root/build_artifacts/glib-split_1728918802549/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_place/bin/glib-mkenums
+ grep -E '^
head -n 1 /home/conda/feedstock_root/build_artifacts/glib-split_1728918802549/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_place/bin/glib-genmarshal | grep -E ^'
#!/home/conda/feedstock_root/build_artifacts/glib-split_1728918802549/_build_env/bin/python3.13
+ head -n 1 /home/conda/feedstock_root/build_artifacts/glib-split_1728918802549/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_place/bin/gtester-report
++ pkg-config --cflags --libs glib-2.0
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.
Oooohhhhh that's tricky — it looks like the YAML parse is yielding surprising results for those lines. If they were passed through to the shell verbatim, I think they would work as you had them before. It might be worth encasing the whole lines in double quotes to make the YAML-level subtlety more apparent.
edit: Actually they wouldn't have worked before due to the missing exclamation points. But I think the \#
is only necessary for the YAML parser, not the shell or regex parser.
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.
I couldn’t get the matching of the # to work. But matching it with anything helped test for the prefix.
Now let’s see if the “fix” works
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 couple of small suggestions but I think this is pretty much ready.
recipe/install.sh
Outdated
# These files are the only difference when running with a different setting of -Dintrospection | ||
if [[ "${CONDA_BUILD_CROSS_COMPILATION:-0}" == 1 ]]; then | ||
cp -ap introspection/lib/girepository-1.0 $PREFIX/lib | ||
cp -ap introspection/share/gir-1.0 $PREFIX/share |
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.
Some wonky indentation here.
recipe/meta.yaml
Outdated
@@ -205,6 +216,12 @@ outputs: | |||
- test -f ${PREFIX}/lib/libglib-2.0${SHLIB_EXT} # [unix] | |||
- glib-compile-resources --help | |||
- gobject-query --help | |||
# I'm not sure why the PREFIX ends up becoming the /usr/bin/env python |
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.
Hmm ... did you check whether these tests fail if you don't apply the shebang fix? I am pretty sure that if the shebang line in the source file had $BUILD_PREFIX
in it, the test would indeed fail, because Conda's prefix-rewriting logic wouldn't be activated at all.
If that's the case, then I think the test is fine as-is. I believe that in all of our build environments, the package test is run inside a directory that's got a sufficiently long absolute path that the /usr/bin/env replacement will always be active. But if you build this recipe outside of the conda-forge framework, the test prefix could conceivably be something like /c/conda-bld/glib-123556890/_test_env
where the rewriting would not kick in.
Isuru's diagnosis is 100% correct, I believe, so it might be good to update the comment and add a link to this pull request.
Well lmk if there is anything else. But also feel free to push cosmetic or functional changes |
Thanks for slogging through this one! |
Closes: #191
Checklist
0
(if the version changed)conda-smithy
(Use the phrase@conda-forge-admin, please rerender
in a comment in this PR for automated rerendering)