Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions crates/openvino-finder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
//! If you do run into problems, the following chart summarizes some of the known installation
//! locations of the OpenVINO files as of version `2022.3.0`:
//!
//! | Installation Method | Path | Available on | Notes |
//! | ------------------- | -------------------------------------------------- | --------------------- | -------------------------------- |
//! | Archive (`.tar.gz`) | `<extracted folder>/runtime/lib/<arch>` | Linux | `<arch>`: `intel64,armv7l,arm64` |
//! | Archive (`.tar.gz`) | `<extracted folder>/runtime/lib/<arch>/Release` | MacOS | `<arch>`: `intel64,armv7l,arm64` |
//! | Archive (`.zip`) | `<unzipped folder>/runtime/bin/<arch>/Release` | Windows | `<arch>`: `intel64,armv7l,arm64` |
//! | PyPI | `<pip install folder>/site-packages/openvino/libs` | Linux, MacOS, Windows | Find install folder with `pip show openvino` |
//! | DEB | `/usr/lib/x86_64-linux-gnu/openvino-<version>/` | Linux (APT-based) | This path is for plugins; the libraries are one directory above |
//! | RPM | `/usr/lib64/` | Linux (YUM-based) | |
//! | Installation Method | Path | Available on | Notes |
//! | ------------------- | -------------------------------------------------- | ----------------------- | -------------------------------- |
//! | Archive (`.tar.gz`) | `<extracted folder>/runtime/lib/<arch>` | Linux | `<arch>`: `intel64,armv7l,arm64` |
//! | Archive (`.tar.gz`) | `<extracted folder>/runtime/lib/<arch>/Release` | `MacOS` | `<arch>`: `intel64,armv7l,arm64` |
//! | Archive (`.zip`) | `<unzipped folder>/runtime/bin/<arch>/Release` | Windows | `<arch>`: `intel64,armv7l,arm64` |
//! | `PyPI` | `<pip install folder>/site-packages/openvino/libs` | Linux, `MacOS`, Windows | Find install folder with `pip show openvino` |
//! | DEB | `/usr/lib/x86_64-linux-gnu/openvino-<version>/` | Linux (APT-based) | This path is for plugins; the libraries are one directory above |
//! | RPM | `/usr/lib64/` | Linux (YUM-based) | |

#![deny(missing_docs)]
#![deny(clippy::all)]
Expand Down Expand Up @@ -83,6 +83,10 @@ macro_rules! check_and_return {
/// The locations above may change over time. As OpenVINO has released new versions, the documented
/// locations of the shared libraries has changed. New versions of this function will reflect this,
/// removing older, unused locations over time.
///
/// # Panics
///
/// Panics if it cannot list the contents of a search directory.
pub fn find(library_name: &str) -> Option<PathBuf> {
let file = format!(
"{}{}{}",
Expand Down Expand Up @@ -295,7 +299,7 @@ fn build_latest_version(dir: &Path, prefix: &str, mut versions: Vec<String>) ->
let latest_version = versions
.first()
.expect("already checked that a version exists");
let filename = format!("{}{}", prefix, latest_version);
let filename = format!("{prefix}{latest_version}");
Some(dir.join(filename))
}

Expand Down
2 changes: 1 addition & 1 deletion crates/openvino/src/blob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl Blob {
/// dimensions array with a size different than the one auto-generated in the bindings; see
/// `struct dimensions` in `openvino-sys/src/generated/types.rs`.
pub fn tensor_desc(&self) -> Result<TensorDesc> {
let blob = self.instance as *const ie_blob_t;
let blob = self.instance.cast_const();

let mut layout = MaybeUninit::uninit();
try_unsafe!(ie_blob_get_layout(blob, layout.as_mut_ptr()))?;
Expand Down
2 changes: 1 addition & 1 deletion crates/openvino/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl Core {
.ok_or(LoadingError::CannotStringifyPath)?
.to_string())
} else {
cstr!("".to_string())
cstr!(String::new())
};

let mut instance = std::ptr::null_mut();
Expand Down
4 changes: 4 additions & 0 deletions crates/openvino/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ pub use request::InferRequest;
pub use tensor_desc::TensorDesc;

/// Emit the version string of the OpenVINO C API backing this implementation.
///
/// # Panics
///
/// Panics if no OpenVINO library can be found.
pub fn version() -> String {
use std::ffi::CStr;
openvino_sys::load().expect("to have an OpenVINO shared library available");
Expand Down
9 changes: 3 additions & 6 deletions crates/xtask/src/bump.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::util::{get_crates, Crate};
use anyhow::{anyhow, Context, Result};
use anyhow::{bail, Context, Result};
use clap::Args;
use semver::{BuildMetadata, Prerelease};
use std::fs;
Expand Down Expand Up @@ -31,10 +31,7 @@ impl BumpCommand {
.windows(2)
.all(|w| w[0].version == w[1].version)
{
anyhow!(
"Not all crate versions are the same: {:?}",
publishable_crates
);
bail!("Not all crate versions are the same: {publishable_crates:?}");
}

// Change the version. Unless specified with a custom version, the `pre` and `build`
Expand Down Expand Up @@ -70,7 +67,7 @@ impl BumpCommand {
}

// Add a Git commit.
let commit_message = format!("Release v{}", next_version_str);
let commit_message = format!("Release v{next_version_str}");
if self.git {
println!("> add Git commit: {}", &commit_message);
if !self.dry_run && self.git {
Expand Down
13 changes: 5 additions & 8 deletions crates/xtask/src/publish.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::util::{exec, get_crates, path_to_crates, Crate};
use anyhow::{anyhow, Result};
use anyhow::{bail, Result};
use clap::Args;
use std::{process::Command, thread::sleep, time::Duration};

Expand All @@ -25,10 +25,7 @@ impl PublishCommand {
.windows(2)
.all(|w| w[0].version == w[1].version)
{
anyhow!(
"Not all crate versions are the same: {:?}",
publishable_crates
);
bail!("Not all crate versions are the same: {publishable_crates:?}");
}

// Check that all of the publishable crates are in `PUBLICATION_ORDER`.
Expand All @@ -40,7 +37,7 @@ impl PublishCommand {
// Publish each crate.
let crates_dir = path_to_crates()?;
for krate in PUBLICATION_ORDER {
println!("> publish {}", krate);
println!("> publish {krate}");
if !self.dry_run {
let krate_dir = crates_dir.clone().join(krate);
let exec_result = exec(
Expand All @@ -53,7 +50,7 @@ impl PublishCommand {
// We want to continue even if a crate does not publish: this allows us to re-run
// the `publish` command if uploading one or more crates fails.
if let Err(e) = exec_result {
println!("Failed to publish crate {}, continuing:\n {}", krate, e);
println!("Failed to publish crate {krate}, continuing:\n {e}");
}

// Hopefully this gives crates.io enough time for subsequent publications to work.
Expand All @@ -64,7 +61,7 @@ impl PublishCommand {
// Tag the repository.
let tag = format!("v{}", publishable_crates[0].version);
if self.git {
println!("> push Git tag: {}", tag);
println!("> push Git tag: {tag}");
if !self.dry_run {
exec(Command::new("git").arg("tag").arg(&tag))?;
exec(Command::new("git").arg("push").arg("origin").arg(&tag))?;
Expand Down