Skip to content
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

Disentangle OpamProcess.resolve_command and OpamSystem.resolve_command #5991

Merged
merged 2 commits into from
Jun 7, 2024

Conversation

dra27
Copy link
Member

@dra27 dra27 commented Jun 6, 2024

The opam init menu overhaul wants to be able to use resolve_command from within OpamStd.Sys (to be used with some low-level functions), but this isn't possible at present because the default for OpamSystem.resolve_command's ~env argument is OpamProcess.default_env.

However, since #3348 there's already been a slightly unholy mess (added by me...) to allow OpamProcess to use resolve_command. This PR disentagles it slightly, by moving the bulk of the logic to OpamStd.Sys and leaving the default argument handling in OpamProcess and then simply making OpamSystem.resolve_command an alias for OpamProcess.resolve_command. Not totally sure why I didn't do that in 2018...

@rjbou rjbou self-requested a review June 6, 2024 09:29
@rjbou rjbou added this to the 2.2.0~beta3 milestone Jun 6, 2024
@dra27 dra27 changed the title Disentagle OpamProcess.resolve_command and OpamSystem.resolve_command Disentangle OpamProcess.resolve_command and OpamSystem.resolve_command Jun 6, 2024
src/core/opamStd.ml Outdated Show resolved Hide resolved
src/core/opamStd.ml Outdated Show resolved Hide resolved
src/core/opamStd.ml Outdated Show resolved Hide resolved
src/core/opamStd.ml Show resolved Hide resolved
Copy link
Collaborator

@rjbou rjbou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

let set_resolve_command =
let called = ref false in
fun resolve_command ->
if !called then invalid_arg "Just what do you think you're doing, Dave?";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh no!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh, heh - @AltGr let that in #3348 🙂

dra27 added 2 commits June 7, 2024 10:08
Allow OpamStd.Sys to be have access to PATH-resolving machinery from
OpamSystem. This also allows the dependency knot between OpamSystem and
OpamProcess to be solved more simply.
Exposes the portion of OpamStd.Sys.resolve_command which searches the
PATH environment for a given basename.
@kit-ty-kate
Copy link
Member

Thanks!

@kit-ty-kate kit-ty-kate merged commit cab5c2e into ocaml:master Jun 7, 2024
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants