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

pyoxidizer run extra args are ignored #665

Open
pquentin opened this issue Dec 8, 2022 · 0 comments
Open

pyoxidizer run extra args are ignored #665

pquentin opened this issue Dec 8, 2022 · 0 comments

Comments

@pquentin
Copy link

pquentin commented Dec 8, 2022

The PyOxidizer Getting Started docs suggest using pyoxidizer run -- [args]:

Now let's try building and running the new configuration::
$ pyoxidizer run -- --help
...
Compiling pyapp v0.1.0 (/home/gps/src/pyapp)
Finished dev [unoptimized + debuginfo] target(s) in 5.49s
writing executable to /home/gps/src/pyapp/build/x86_64-unknown-linux-gnu/debug/exe/pyapp
Usage: pyapp [options]
Options:
--version show program's version number and exit
-h, --help show this help message and exit
You've just produced an executable for ``pyflakes``!
.. note::
``pyflakes`` with no command arguments will read from stdin and will
effectively hang until stdin is closed (typically via ``CTRL + D``). So
the ``-- --help`` in the above example is important, as it forces
the command to produce output.

But it does not actually work. Looking at the code, pyoxidizer run does accept extra args, which get passed to projectmgmt::run as _extra_args:

#[allow(clippy::too_many_arguments)]
pub fn run(
env: &Environment,
project_path: &Path,
target_triple: Option<&str>,
release: bool,
target: Option<&str>,
extra_vars: HashMap<String, Option<String>>,
_extra_args: &[&str],
verbose: bool,
) -> Result<()> {
let config_path = find_pyoxidizer_config_file_env(project_path).ok_or_else(|| {
anyhow!(
"unable to find PyOxidizer config file at {}",
project_path.display()
)
})?;
let target_triple = resolve_target(target_triple)?;
let mut context = EvaluationContextBuilder::new(env, config_path.clone(), target_triple)
.extra_vars(extra_vars)
.release(release)
.verbose(verbose)
.resolve_target_optional(target)
.into_context()?;
context.evaluate_file(&config_path)?;
context.run_target(target)
}

However, this function does not use them so they just get lost. I looks like the regression was introduced in df0d459 released in 0.5.1. I tried to see quickly if I could fix the issue, but looks like starlark::eval::EvaluationContextBuilder does not support extra args at all? I don't know Rust or PyOxidizer enough to tell.

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

No branches or pull requests

1 participant