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
6 changes: 3 additions & 3 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion crates/openvino-finder/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "openvino-finder"
version = "0.3.0"
version = "0.3.1"
description = "A helper crate for finding OpenVINO installations on a system."
license = "Apache-2.0"
readme = "README.md"
Expand Down
6 changes: 3 additions & 3 deletions crates/openvino-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "openvino-sys"
version = "0.3.0"
version = "0.3.1"
license = "Apache-2.0"
description = "Low-level bindings for OpenVINO (use the `openvino` crate for easier-to-use bindings)."
readme = "README.md"
Expand All @@ -24,11 +24,11 @@ links = "inference_engine_c_api"
[dependencies]
lazy_static = {version = "1.4", optional = true }
libloading = {version = "0.7", optional = true }
openvino-finder = {version = "0.3.0", path = "../openvino-finder" }
openvino-finder = {version = "0.3.1", path = "../openvino-finder" }

[build-dependencies]
cmake = "0.1.45"
openvino-finder = {version = "0.3.0", path = "../openvino-finder" }
openvino-finder = {version = "0.3.1", path = "../openvino-finder" }

[features]
default = ["cpu"]
Expand Down
2 changes: 1 addition & 1 deletion crates/openvino-sys/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ information, including build instructions.
[C API]: https://docs.openvinotoolkit.org/2020.1/ie_c_api/groups.html
[openvino-sys]: https://crates.io/crates/openvino-sys
[openvino]: https://crates.io/crates/openvino
[README]: https://github.com/abrown/openvino/blob/rust-bridge/inference-engine/ie_bridges/rust/README.md
[README]: https://github.com/intel/openvino-rs
[upstream]: upstream
30 changes: 17 additions & 13 deletions crates/openvino-sys/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
//! This crate provides low-level, unsafe, Rust bindings to OpenVINO™ using its [C API]. If you are
//! looking to use OpenVINO™ from Rust, you likely should look at the ergonomic, safe bindings in
//! [openvino], which depends on this crate. See the repository [README] for more information,
//! including build instructions.
//!
//! [C API]: https://docs.openvinotoolkit.org/2020.1/ie_c_api/groups.html
//! [openvino-sys]: https://crates.io/crates/openvino-sys
//! [openvino]: https://crates.io/crates/openvino
//! [README]: https://github.com/intel/openvino-rs/tree/main/crates/openvino-sys
//!
//! An example interaction with raw [openvino-sys]:
//! ```
//! # use std::ffi::CStr;
//! openvino_sys::library::load().expect("to have an OpenVINO library available");
//! let version = unsafe { CStr::from_ptr(openvino_sys::ie_c_api_version().api_version) };
//! assert!(version.to_string_lossy().starts_with("2.1"));
//! ```
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
Expand Down Expand Up @@ -38,16 +55,3 @@ pub mod library {
}
}
}

#[cfg(test)]
mod tests {
use super::*;
use std::ffi::CStr;

#[test]
fn check_version() {
load().expect("to have an OpenVINO library available");
let version = unsafe { CStr::from_ptr(ie_c_api_version().api_version) };
assert!(version.to_string_lossy().starts_with("2.1"));
}
}
7 changes: 5 additions & 2 deletions crates/openvino/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "openvino"
version = "0.3.0"
version = "0.3.1"
license = "Apache-2.0"
description = "High-level bindings for OpenVINO."
readme = "README.md"
Expand All @@ -13,11 +13,14 @@ exclude = [
]

[dependencies]
openvino-sys = { path = "../openvino-sys", version = "0.3.0" }
openvino-sys = { path = "../openvino-sys", version = "0.3.1" }
thiserror = "1.0.20"

[dev-dependencies]
float-cmp = "0.8"

[features]
runtime-linking = ["openvino-sys/runtime-linking"]

[package.metadata.docs.rs]
features = ["runtime-linking"]
2 changes: 1 addition & 1 deletion crates/openvino/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ repository [README] for more information, such as build instructions.
> This crate is currently experimental--its API surface is subject to change.

[openvino]: https://crates.io/crates/openvino
[README]: https://github.com/abrown/openvino/blob/rust-bridge/inference-engine/ie_bridges/rust/README.md
[README]: https://github.com/intel/openvino-rs
10 changes: 0 additions & 10 deletions crates/openvino/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,3 @@ impl Core {
Ok(ExecutableNetwork { instance })
}
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn construct_core() {
let _ = Core::new(None).unwrap();
}
}
4 changes: 2 additions & 2 deletions crates/openvino/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ impl InferenceError {
}
}

/// Enumberate setup failures: in some cases, this library calls library loading code that may fail
/// in a different way (i.e., [LoadingError]) than the calls in to the OpenVINO libraries (i.e.,
/// Enumerate setup failures: in some cases, this library will call library-loading code that may
/// fail in a different way (i.e., [LoadingError]) than the calls to the OpenVINO libraries (i.e.,
/// [InferenceError]).
#[derive(Debug, Error)]
pub enum SetupError {
Expand Down
26 changes: 16 additions & 10 deletions crates/openvino/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
//! The [openvino] crate provides high-level, ergonomic, safe Rust bindings to OpenVINO. See the
//! repository [README] for more information, such as build instructions.
//!
//! [openvino]: https://crates.io/crates/openvino
//! [README]: https://github.com/intel/openvino-rs
//!
//! Check the loaded version of OpenVINO:
//! ```
//! assert!(openvino::version().starts_with("2.1"))
//! ```
//!
//! Most interaction with OpenVINO begins with instantiating a [Core]:
//! ```
//! let _ = openvino::Core::new(None).expect("to instantiate the OpenVINO library");
//! ```

mod blob;
mod core;
mod error;
Expand Down Expand Up @@ -29,13 +45,3 @@ pub fn version() -> String {
unsafe { openvino_sys::ie_version_free(&mut ie_version as *mut openvino_sys::ie_version_t) };
str_version
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn check_version() {
assert!(version().starts_with("2.1"),)
}
}
2 changes: 1 addition & 1 deletion crates/xtask/src/bump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,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
40 changes: 18 additions & 22 deletions crates/xtask/src/publish.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use crate::util::{get_crates, path_to_crates, Crate};
use anyhow::{anyhow, Context, Result};
use crate::util::{exec, get_crates, path_to_crates, Crate};
use anyhow::{anyhow, Result};
use std::{process::Command, thread::sleep, time::Duration};
use structopt::StructOpt;

#[derive(Debug, StructOpt)]
#[structopt(name = "bump")]
pub struct PublishCommand {
/// Tag the current commit and push the tags to the default upstream; equivalent to `git tag
/// v[version]` and `git push v[version]`.
/// v[version] && git push origin v[version]`.
#[structopt(long)]
git: bool,
/// Do not publish any crates; instead, simply print the actions that would have been taken.
Expand Down Expand Up @@ -43,13 +43,19 @@ impl PublishCommand {
for krate in PUBLICATION_ORDER {
println!("> publish {}", krate);
if !self.dry_run {
assert!(Command::new("cargo")
.arg("publish")
.current_dir(crates_dir.clone().join(krate))
.arg("--no-verify")
.status()
.with_context(|| format!("failed to run cargo publish on '{}' crate", krate))?
.success());
let crate_dir = crates_dir.clone().join(krate);
let exec_result = exec(
Command::new("cargo")
.arg("publish")
.arg("--no-verify")
.current_dir(&crate_dir),
);

// 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);
}

// Hopefully this gives crates.io enough time for subsequent publications to work.
sleep(Duration::from_secs(20));
Expand All @@ -61,18 +67,8 @@ impl PublishCommand {
if self.git {
println!("> push Git tag: {}", tag);
if !self.dry_run {
assert!(Command::new("git")
.arg("tag")
.arg(&tag)
.status()
.with_context(|| format!("failed to run `git tag {}` command", &tag))?
.success());
assert!(Command::new("git")
.arg("push")
.arg(&tag)
.status()
.with_context(|| format!("failed to run `git push {}` command", &tag))?
.success());
exec(Command::new("git").arg("tag").arg(&tag))?;
exec(Command::new("git").arg("push").arg("origin").arg(&tag))?;
}
}

Expand Down
14 changes: 12 additions & 2 deletions crates/xtask/src/util.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
use anyhow::{Context, Result};
use anyhow::{anyhow, Context, Result};
use semver::Version;
use std::fs;
use std::path::PathBuf;
use std::{fs, process::Command};
use toml::Value;

/// Convenience wrapper for executing commands.
pub fn exec(command: &mut Command) -> Result<()> {
let status = command.status()?;
if status.success() {
Ok(())
} else {
Err(anyhow!("failed to execute: {:?}", &command))
}
}

/// Determine the path to the `crates` directory`.
pub fn path_to_crates() -> Result<PathBuf> {
Ok(PathBuf::from(file!())
Expand Down