Merge branch 'clap' into 'master'
Rust: Restore compatibility with Debian Bookworm See merge request World/Phosh/squeekboard!589
This commit is contained in:
		@ -2,7 +2,7 @@
 | 
				
			|||||||
# For the newer-than-Byzantium config
 | 
					# For the newer-than-Byzantium config
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bitflags = "1.3.*"
 | 
					bitflags = "1.3.*"
 | 
				
			||||||
clap = { version = "3.2.*", features=["std"], default-features = false }
 | 
					clap = { version = "4.*", features=["std"], default-features = false }
 | 
				
			||||||
zbus = "1.9.*"
 | 
					zbus = "1.9.*"
 | 
				
			||||||
zvariant = "2.10.*"
 | 
					zvariant = "2.10.*"
 | 
				
			||||||
# Newer versions seem to confuse the version of Cargo on Debian Bullseye
 | 
					# Newer versions seem to confuse the version of Cargo on Debian Bullseye
 | 
				
			||||||
 | 
				
			|||||||
@ -24,6 +24,7 @@ path = "@path@/examples/find_orphan_layouts.rs"
 | 
				
			|||||||
[features]
 | 
					[features]
 | 
				
			||||||
glib_v0_14 = []
 | 
					glib_v0_14 = []
 | 
				
			||||||
zbus_v1_5 = []
 | 
					zbus_v1_5 = []
 | 
				
			||||||
 | 
					clap_v4 = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Dependencies which don't change based on build flags
 | 
					# Dependencies which don't change based on build flags
 | 
				
			||||||
[dependencies]
 | 
					[dependencies]
 | 
				
			||||||
 | 
				
			|||||||
@ -99,7 +99,7 @@ cargo_toml_base = configure_file(
 | 
				
			|||||||
cargo_patch = []
 | 
					cargo_patch = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if get_option('newer') == true
 | 
					if get_option('newer') == true
 | 
				
			||||||
    cargo_build_flags += ['--features', 'glib_v0_14,zbus_v1_5']
 | 
					    cargo_build_flags += ['--features', 'glib_v0_14,zbus_v1_5,clap_v4']
 | 
				
			||||||
    cargo_deps = files('Cargo.deps.newer')
 | 
					    cargo_deps = files('Cargo.deps.newer')
 | 
				
			||||||
    cargo_lock = files('Cargo.lock.newer')
 | 
					    cargo_lock = files('Cargo.lock.newer')
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
 | 
				
			|||||||
@ -5,12 +5,28 @@ extern crate rs;
 | 
				
			|||||||
use rs::tests::check_layout_file;
 | 
					use rs::tests::check_layout_file;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fn main() -> () {
 | 
					fn main() -> () {
 | 
				
			||||||
 | 
					    #[cfg(feature = "clap_v4")]
 | 
				
			||||||
 | 
					    let matches = clap::Command::new("squeekboard-test-layout")
 | 
				
			||||||
 | 
					        .about("Test keyboard layout for errors. Returns OK or an error message containing further information.")
 | 
				
			||||||
 | 
					        .arg(
 | 
				
			||||||
 | 
					            clap::Arg::new("INPUT")
 | 
				
			||||||
 | 
					                .required(true)
 | 
				
			||||||
 | 
					                .help("Yaml keyboard layout file to test")
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
 | 
					        .get_matches();
 | 
				
			||||||
 | 
					    #[cfg(feature = "clap_v4")]
 | 
				
			||||||
 | 
					    let m = matches.get_one::<String>("INPUT");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    #[cfg(not(feature = "clap_v4"))]
 | 
				
			||||||
    let matches = clap_app!(test_layout =>
 | 
					    let matches = clap_app!(test_layout =>
 | 
				
			||||||
        (name: "squeekboard-test-layout")
 | 
					        (name: "squeekboard-test-layout")
 | 
				
			||||||
        (about: "Test keyboard layout for errors. Returns OK or an error message containing further information.")
 | 
					        (about: "Test keyboard layout for errors. Returns OK or an error message containing further information.")
 | 
				
			||||||
        (@arg INPUT: +required "Yaml keyboard layout file to test")
 | 
					        (@arg INPUT: +required "Yaml keyboard layout file to test")
 | 
				
			||||||
    ).get_matches();
 | 
					    ).get_matches();
 | 
				
			||||||
    if check_layout_file(matches.value_of("INPUT").unwrap()) == () {
 | 
					    #[cfg(not(feature = "clap_v4"))]
 | 
				
			||||||
 | 
					    let m = matches.value_of("INPUT");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if check_layout_file(m.unwrap()) == () {
 | 
				
			||||||
        println!("Test result: OK");
 | 
					        println!("Test result: OK");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user