-
-
Notifications
You must be signed in to change notification settings - Fork 107
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
generator.py: Use cargo run instead of guessing path #1597
Conversation
generator.py
Outdated
if conf.gir_path: | ||
stdout, stderr = await spawn_process(conf.gir_path, args) | ||
else: | ||
cargo_args = ["run", "--release", "--quiet", "--manifest-path=gir/Cargo.toml", "--"] |
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.
Shouldn't that be DEFAULT_GIR_DIRECTORY
? Now you're assuming that custom projects always have a submodule named gir
? Perhaps we better fold this in with the configuration parameter gir_path
somehow?
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.
Shouldn't that be
DEFAULT_GIR_DIRECTORY
?
Could make sense to change this. But I'm currently following the previous code where it was hardcoded.
Now you're assuming that custom projects always have a submodule named
gir
?
That's nothing new, it's the same as with the previous code:
def update_workspace():
return run_command(["cargo", "build", "--release"], "gir")
Perhaps we better fold this in with the configuration parameter
gir_path
somehow?
Well, that path is a binary path. Not sure how you would couple that with a source directory for gir.
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.
By adding a "defaulted" "gir directory" path argument, and making it mutually exclusive with --gir-path
perhaps? That way the default (hardcoded) "gir" suddenly becomes visible too.
Currently, the script just guesses a target path based on the default config. This fails if the project or the user has configured a different target directory. This code is shorter and more correct.
de50165
to
c6ba79e
Compare
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 to me. Any other comments?
One downside of this, found now that I started using this, is that |
I don't remember how the old solution solved that, but you could bring back a separate |
@sophie-h sure, I'll look into it 👍 Additionally, it looks like |
Finally tackled in #1613. |
Currently, the script just guesses a target path based on the default config. This fails if the project or the user has configured a different target directory.
This code is shorter and more correct.