Skip to content

Commit

Permalink
Add -v flags to spk-convert-pip and update spk convert to pass ve…
Browse files Browse the repository at this point in the history
…rbosity through (#1019)

* Adds verbose flag to spk-convert-pip, and updates spk convert to pass verbosity level on

Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
  • Loading branch information
dcookspi authored May 15, 2024
1 parent cd83051 commit 087af1f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/spk-cli/cmd-convert/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ async-trait = { workspace = true }
clap = { workspace = true }
spk-cli-common = { workspace = true }
spk-cmd-env = { workspace = true }
tracing = { workspace = true }
5 changes: 5 additions & 0 deletions crates/spk-cli/cmd-convert/src/cmd_convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ impl Run for Convert {

let mut command = vec![converter_package.clone()];
command.extend(self.args.clone());
if self.verbose > 0 {
// Pass the verbosity level into the conversion command
command.push(format!("-{}", "v".repeat(self.verbose.into())));
}
tracing::debug!("Underlying command: {}", command.join(" "));

let mut env = spk_cmd_env::cmd_env::Env {
solver: self.solver.clone(),
Expand Down
7 changes: 7 additions & 0 deletions packages/spk-convert-pip/spk-convert-pip
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ def main() -> int:
pip_cmd = argparse.ArgumentParser(
"spk-convert-pip", description="Convert and import packages using pip"
)
pip_cmd.add_argument(
"-v", "--verbose", action="count", dest="verbose", default=0,
help="Increase the verbosity of the output"
)
pip_cmd.add_argument(
"--python-version", default="3.7", help="The version of python to install for"
)
Expand Down Expand Up @@ -89,6 +93,9 @@ def main() -> int:
original_cmd_and_args = " ".join(sys.argv)
args = pip_cmd.parse_args()

if args.verbose > 0:
_LOGGER.setLevel(logging.DEBUG)

specs = []
importer = PipImporter().with_cli_args(original_cmd_and_args).recursive(args.deps)
if args.python_version:
Expand Down

0 comments on commit 087af1f

Please sign in to comment.