Skip to content

Commit 75f5c96

Browse files
committed
Update crate dependencies
This is not only regular dependency gardening, it also switches from `structopt` to `clap` to avoid some unmaintained dependencies (`atty`, `ansi_term`). This also switches to `env_logger` instead of the `pretty_env_logger` wrapper.
1 parent a6caa09 commit 75f5c96

File tree

11 files changed

+433
-228
lines changed

11 files changed

+433
-228
lines changed

Cargo.lock

Lines changed: 382 additions & 178 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/openvino-finder/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ cfg-if = "1.0"
1616
log = "0.4"
1717

1818
[dev-dependencies]
19-
pretty_env_logger = "0.4"
19+
env_logger = "0.10"

crates/openvino-sys/Cargo.toml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,20 @@ include = [
2525
links = "inference_engine_c_api"
2626

2727
[dependencies]
28-
once_cell = {version = "1.12.0", optional = true }
29-
libloading = {version = "0.7", optional = true }
30-
openvino-finder = {version = "0.5.0", path = "../openvino-finder" }
28+
once_cell = { version = "1.18", optional = true }
29+
libloading = { version = "0.8", optional = true }
30+
openvino-finder = { version = "0.5.0", path = "../openvino-finder" }
3131

3232
[build-dependencies]
33-
openvino-finder = {version = "0.5.0", path = "../openvino-finder" }
34-
pretty_env_logger = "0.4"
33+
openvino-finder = { version = "0.5.0", path = "../openvino-finder" }
34+
env_logger = "0.10"
3535

3636
[features]
3737
# Linking features: `build.rs` will default to dynamic linking if none is selected.
38-
dynamic-linking = [] # Will find and bind to an OpenVINO shared library at compile time.
39-
runtime-linking = ["libloading", "once_cell"] # Will bind to an OpenVINO shared library at runtime using `load`.
38+
# - Will find and bind to an OpenVINO shared library at compile time.
39+
dynamic-linking = []
40+
# - Will bind to an OpenVINO shared library at runtime using `load`.
41+
runtime-linking = ["libloading", "once_cell"]
4042

4143
[package.metadata.docs.rs]
4244
features = ["runtime-linking"]

crates/openvino/Cargo.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,12 @@ documentation = "https://docs.rs/openvino"
1010
keywords = ["openvino", "machine-learning", "ml", "neural-network"]
1111
categories = ["api-bindings", "science"]
1212
edition = "2018"
13-
exclude = [
14-
"/tests"
15-
]
13+
exclude = ["/tests"]
1614

1715
[dependencies]
1816
openvino-sys = { path = "../openvino-sys", version = "0.5.0" }
1917
openvino-finder = { path = "../openvino-finder", version = "0.5.0" }
20-
thiserror = "1.0.20"
18+
thiserror = "1.0"
2119

2220
[dev-dependencies]
2321
float-cmp = "0.9"

crates/xtask/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ publish = false
99

1010
[dependencies]
1111
anyhow = "1.0"
12-
bindgen = "0.61"
13-
structopt = { version = "0.3", features = ["color", "suggestions"] }
14-
toml = "0.5.8"
12+
bindgen = "0.68.1"
13+
clap = { version = "4.4.4", features = ["derive"] }
14+
toml = "0.8.0"
1515
semver = "1.0"

crates/xtask/src/bump.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
use crate::util::{get_crates, Crate};
22
use anyhow::{anyhow, Context, Result};
3+
use clap::Args;
34
use semver::{BuildMetadata, Prerelease};
45
use std::fs;
56
use std::process::Command;
6-
use structopt::StructOpt;
77

8-
#[derive(Debug, StructOpt)]
9-
#[structopt(name = "bump")]
8+
#[derive(Debug, Args)]
109
pub struct BumpCommand {
1110
/// Do not modify the Cargo.toml files; instead, simply print the actions that would have been
1211
/// taken.
13-
#[structopt(long = "dry-run")]
12+
#[arg(long = "dry-run")]
1413
dry_run: bool,
1514
/// Add a conventional Git commit message for the bump changes; equivalent to `git commit -a -m
1615
/// 'Release v[bumped version]'`.
17-
#[structopt(long)]
16+
#[arg(long)]
1817
git: bool,
1918
/// What part of the semver version to change: major | minor | patch | [version string]
20-
#[structopt(name = "KIND")]
19+
#[arg(name = "KIND")]
2120
bump: Bump,
2221
}
2322

@@ -91,7 +90,7 @@ impl BumpCommand {
9190
}
9291

9392
/// Enumerate the ways a version can change.
94-
#[derive(Debug)]
93+
#[derive(Clone, Debug)]
9594
pub enum Bump {
9695
Major,
9796
Minor,

crates/xtask/src/codegen.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
use crate::util::path_to_crates;
22
use anyhow::{anyhow, ensure, Context, Result};
3+
use clap::Args;
34
use std::fs::{File, OpenOptions};
45
use std::io::Write;
56
use std::path::{Path, PathBuf};
6-
use structopt::StructOpt;
77

8-
#[derive(Debug, StructOpt)]
9-
#[structopt(name = "codegen")]
8+
#[derive(Debug, Args)]
109
pub struct CodegenCommand {
1110
/// The path to OpenVINO's Inference Engine C API header; by default,
1211
/// `.../openvino-sys/upstream/inference-engine/ie_bridges/c/include/c_api/ie_c_api.h`.
13-
#[structopt(short = "i", long = "input-header-file")]
12+
#[arg(short = 'i', long = "input-header-file")]
1413
header_file: Option<PathBuf>,
1514

1615
/// The path to the directory in which to output the generated files; by default,
1716
/// `.../openvino-sys/crates/src/generated`.
18-
#[structopt(short = "o", long = "output-directory")]
17+
#[arg(short = 'o', long = "output-directory")]
1918
output_directory: Option<PathBuf>,
2019
}
2120

crates/xtask/src/main.rs

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,31 @@ mod util;
1010

1111
use anyhow::Result;
1212
use bump::BumpCommand;
13+
use clap::{Parser, Subcommand};
1314
use codegen::CodegenCommand;
1415
use publish::PublishCommand;
15-
use structopt::{clap::AppSettings, StructOpt};
1616

1717
fn main() -> Result<()> {
18-
let command = XtaskCommand::from_args();
19-
command.execute()?;
18+
let cli = Cli::parse();
19+
cli.command.execute()?;
2020
Ok(())
2121
}
2222

23-
#[derive(StructOpt, Debug)]
24-
#[structopt(
25-
version = env!("CARGO_PKG_VERSION"),
26-
global_settings = &[
27-
AppSettings::VersionlessSubcommands,
28-
AppSettings::ColoredHelp
29-
],
30-
)]
23+
#[derive(Parser, Debug)]
24+
#[command(author, version, about, long_about = None)]
25+
struct Cli {
26+
#[command(subcommand)]
27+
command: XtaskCommand,
28+
}
29+
30+
// #[structopt(
31+
// version = env!("CARGO_PKG_VERSION"),
32+
// global_settings = &[
33+
// AppSettings::VersionlessSubcommands,
34+
// AppSettings::ColoredHelp
35+
// ],
36+
// )]
37+
#[derive(Debug, Subcommand)]
3138
enum XtaskCommand {
3239
/// Generate the Rust bindings for OpenVINO to use in the openvino-sys crate.
3340
Codegen(CodegenCommand),

crates/xtask/src/publish.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
use crate::util::{exec, get_crates, path_to_crates, Crate};
22
use anyhow::{anyhow, Result};
3+
use clap::Args;
34
use std::{process::Command, thread::sleep, time::Duration};
4-
use structopt::StructOpt;
55

6-
#[derive(Debug, StructOpt)]
7-
#[structopt(name = "bump")]
6+
#[derive(Debug, Args)]
87
pub struct PublishCommand {
98
/// Tag the current commit and push the tags to the default upstream; equivalent to `git tag
109
/// v[version] && git push origin v[version]`.
11-
#[structopt(long)]
10+
#[arg(long)]
1211
git: bool,
1312
/// Do not publish any crates; instead, simply print the actions that would have been taken.
14-
#[structopt(long = "dry-run")]
13+
#[arg(long = "dry-run")]
1514
dry_run: bool,
1615
}
1716

crates/xtask/src/util.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ pub fn get_crates() -> Result<Vec<Crate>> {
3434
let mut crates = Vec::new();
3535
for entry in fs::read_dir(crates_dir)? {
3636
let path = entry?.path().join("Cargo.toml");
37-
let contents: Vec<u8> = fs::read(&path)?;
38-
let toml: Value = toml::from_slice(&contents)
37+
let contents = fs::read_to_string(&path)?;
38+
let toml: Value = contents
39+
.parse()
3940
.with_context(|| format!("unable to parse TOML of {}", &path.display()))?;
4041

4142
let name = toml["package"]["name"]

0 commit comments

Comments
 (0)