Skip to content

Commit

Permalink
Merge pull request #1403 from messense/new-init-bindings-doc
Browse files Browse the repository at this point in the history
Add link to bindings guide in `new` and `init` commands
  • Loading branch information
messense authored Jan 9, 2023
2 parents c313833 + a05635e commit ab1fae0
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use std::path::PathBuf;
version,
name = env!("CARGO_PKG_NAME"),
display_order = 1,
after_help = "Visit https://maturin.rs to learn more about maturin."
)]
#[cfg_attr(feature = "cargo-clippy", allow(clippy::large_enum_variant))]
/// Build and publish crates with pyo3, rust-cpython and cffi bindings as well
Expand Down
5 changes: 3 additions & 2 deletions src/new_project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,9 @@ fn generate_project(
} else {
let selection = Select::with_theme(&ColorfulTheme::default())
.with_prompt(format!(
"🤷 {}",
style("Which kind of bindings to use?").bold()
"🤷 {}\n 📖 {}",
style("Which kind of bindings to use?").bold(),
style("Documentation: https://maturin.rs/bindings.html").dim()
))
.items(&bindings_items)
.default(0)
Expand Down
17 changes: 17 additions & 0 deletions tests/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,26 @@ fn cli_tests() {
let t = trycmd::TestCases::new();
t.default_bin_name("maturin");
t.case("tests/cmd/*.toml");

#[cfg(not(feature = "upload"))]
{
t.skip("tests/cmd/upload.toml");
t.skip("tests/cmd/publish.toml");
}

#[cfg(not(feature = "zig"))]
{
t.skip("tests/cmd/build.toml");
}

#[cfg(not(feature = "scaffolding"))]
{
t.skip("tests/cmd/new.toml");
t.skip("tests/cmd/init.toml");
}

#[cfg(not(all(feature = "upload", feature = "zig", feature = "scaffolding")))]
{
t.skip("tests/cmd/maturin.toml");
}
}
Empty file added tests/cmd/maturin.stderr
Empty file.
21 changes: 21 additions & 0 deletions tests/cmd/maturin.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Build and publish crates with pyo3, rust-cpython and cffi bindings as well as rust binaries as
python packages

Usage: maturin[EXE] <COMMAND>

Commands:
build Build the crate into python packages
publish Build and publish the crate as python packages to pypi
list-python Search and list the available python installations
develop Install the crate as module in the current virtualenv
sdist Build only a source distribution (sdist) without compiling
init Create a new cargo project in an existing directory
new Create a new cargo project
upload Upload python packages to pypi
help Print this message or the help of the given subcommand(s)

Options:
-h, --help Print help information
-V, --version Print version information

Visit https://maturin.rs to learn more about maturin.
2 changes: 2 additions & 0 deletions tests/cmd/maturin.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bin.name = "maturin"
args = "--help"
8 changes: 7 additions & 1 deletion tests/common/integration.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::common::{check_installed, create_virtualenv, maybe_mock_cargo, test_python_path};
use anyhow::{bail, Context, Result};
#[cfg(feature = "zig")]
use cargo_zigbuild::Zig;
use clap::Parser;
use maturin::{BuildOptions, PythonInterpreter};
Expand Down Expand Up @@ -52,7 +53,12 @@ pub fn test_integration(
cli.push(target)
}

let test_zig = if zig && (env::var("GITHUB_ACTIONS").is_ok() || Zig::find_zig().is_ok()) {
#[cfg(feature = "zig")]
let zig_found = Zig::find_zig().is_ok();
#[cfg(not(feature = "zig"))]
let zig_found = false;

let test_zig = if zig && (env::var("GITHUB_ACTIONS").is_ok() || zig_found) {
cli.push("--zig");
true
} else {
Expand Down

0 comments on commit ab1fae0

Please sign in to comment.