Skip to content

Commit

Permalink
Merge branch 'master' into pmarks/deps
Browse files Browse the repository at this point in the history
  • Loading branch information
termoshtt committed Jul 28, 2022
2 parents b372373 + 918528e commit 25aa19d
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 26 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Unreleased

### Changed

- Remove use * for external crates https://github.com/rust-math/intel-mkl-src/pull/70
- Repository of container image has been moved to GitHub Container Registry (ghcr.io) from DockerHub https://github.com/rust-math/intel-mkl-src/pull/60

0.6.0+mkl2020.1 - 2020-06-23
Expand Down
6 changes: 3 additions & 3 deletions intel-mkl-src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@

#![cfg_attr(feature = "download", allow(unreachable_code))]

use anyhow::{bail, Error};
use anyhow::{bail, Result};
use intel_mkl_tool::*;
use std::{env, path::*};
use std::{env, path::PathBuf};

#[cfg(feature = "mkl-static-lp64-iomp")]
const MKL_CONFIG: &str = "mkl-static-lp64-iomp";
Expand All @@ -43,7 +43,7 @@ const MKL_CONFIG: &str = "mkl-dynamic-ilp64-iomp";
#[cfg(feature = "mkl-dynamic-ilp64-seq")]
const MKL_CONFIG: &str = "mkl-dynamic-ilp64-seq";

fn main() -> Result<(), Error> {
fn main() -> Result<()> {
let cfg = Config::from_str(MKL_CONFIG).unwrap();

// already exists on system
Expand Down
4 changes: 2 additions & 2 deletions intel-mkl-tool/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use anyhow::{bail, Error};
use anyhow::{bail, Result};
use intel_mkl_tool::*;
use std::{env, path::PathBuf};
use structopt::StructOpt;
Expand Down Expand Up @@ -32,7 +32,7 @@ enum Opt {
},
}

fn main() -> Result<(), Error> {
fn main() -> Result<()> {
let opt = Opt::from_args();

match opt {
Expand Down
12 changes: 6 additions & 6 deletions intel-mkl-tool/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use derive_more::*;
use anyhow::{bail, Error};
use anyhow::{bail, Result};
use derive_more::Display;

pub const VALID_CONFIGS: &[&str] = &[
"mkl-dynamic-ilp64-iomp",
Expand Down Expand Up @@ -45,7 +45,7 @@ pub struct Config {
}

impl Config {
pub fn from_str(name: &str) -> Result<Self, Error> {
pub fn from_str(name: &str) -> Result<Self> {
let parts: Vec<_> = name.split("-").collect();
if parts.len() != 4 {
bail!("Invalid name: {}", name);
Expand Down Expand Up @@ -151,7 +151,7 @@ mod tests {
use super::*;

#[test]
fn name_to_config() -> Result<(), Error> {
fn name_to_config() -> Result<()> {
let cfg = Config::from_str("mkl-static-lp64-iomp")?;
assert_eq!(
cfg,
Expand All @@ -165,7 +165,7 @@ mod tests {
}

#[test]
fn name_to_config_to_name() -> Result<(), Error> {
fn name_to_config_to_name() -> Result<()> {
for name in VALID_CONFIGS {
let cfg = Config::from_str(name)?;
assert_eq!(&cfg.name(), name);
Expand All @@ -174,7 +174,7 @@ mod tests {
}

#[test]
fn invalid_names() -> Result<(), Error> {
fn invalid_names() -> Result<()> {
assert!(Config::from_str("").is_err());
assert!(Config::from_str("static-lp64-iomp").is_err());
assert!(Config::from_str("mkll-static-lp64-iomp").is_err());
Expand Down
11 changes: 6 additions & 5 deletions intel-mkl-tool/src/download.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use crate::*;
use crate::{s3_addr, Config};
use anyhow::Result;
use curl::easy::Easy;
use std::fs;
use std::{fs, path::Path};

impl Config {
/// Download archive from AWS S3, and expand into `${out_dir}/*.so`
pub fn download<P: AsRef<Path>>(&self, out_dir: P) -> Result<(), Error> {
pub fn download<P: AsRef<Path>>(&self, out_dir: P) -> Result<()> {
let out_dir = out_dir.as_ref();
if out_dir.exists() {
fs::create_dir_all(&out_dir)?;
Expand All @@ -21,7 +22,7 @@ impl Config {
///
/// - This function expands obtained data into memory space
///
fn read_from_url(url: &str) -> Result<Vec<u8>, Error> {
fn read_from_url(url: &str) -> Result<Vec<u8>> {
let mut data = Vec::new();
let mut handle = Easy::new();
handle.fail_on_error(true)?;
Expand All @@ -47,7 +48,7 @@ mod tests {
($name:expr) => {
paste::item! {
#[test]
fn [<download_$name>]() -> Result<(), Error> {
fn [<download_$name>]() -> Result<()> {
let name = $name;
let cfg = Config::from_str(name)?;
cfg.download(format!("test_download/{}", name))?;
Expand Down
9 changes: 5 additions & 4 deletions intel-mkl-tool/src/entry.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use crate::*;
use crate::{mkl, xdg_home_path, Config, LinkType, VALID_CONFIGS};
use anyhow::{bail, Result};
use derive_more::Deref;
use std::{
collections::{HashMap, HashSet},
fs,
io::{self, BufRead},
path::{Path, PathBuf},
};
use anyhow::{Error, bail};

#[derive(Debug, Deref)]
struct Targets(HashMap<String, Option<PathBuf>>);
Expand Down Expand Up @@ -69,7 +70,7 @@ impl Entry {
///
/// Returns error if no library found
///
pub fn from_config(config: Config) -> Result<Self, Error> {
pub fn from_config(config: Config) -> Result<Self> {
let mut targets = Targets::new(config);

// OUT_DIR
Expand Down Expand Up @@ -150,7 +151,7 @@ impl Entry {
///
/// - This will not work for OUT_DIR or XDG_DATA_HOME entry,
/// and returns Error in these cases
pub fn version(&self) -> Result<(u32, u32), Error> {
pub fn version(&self) -> Result<(u32, u32)> {
for (path, _) in &self.found_files() {
// assumes following directory structure:
//
Expand Down
3 changes: 1 addition & 2 deletions intel-mkl-tool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@
#![cfg_attr(not(feature = "archive"), allow(dead_code))]

use anyhow::Error;
use std::path::*;
use std::path::PathBuf;

mod config;
mod entry;
Expand Down
11 changes: 7 additions & 4 deletions intel-mkl-tool/src/package.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
use crate::*;
use std::{fs, io};
use anyhow::{Error, bail};
use crate::Entry;
use anyhow::{bail, Result};
use std::{
fs, io,
path::{Path, PathBuf},
};

impl Entry {
pub fn package(&self, out_dir: &Path) -> Result<PathBuf, Error> {
pub fn package(&self, out_dir: &Path) -> Result<PathBuf> {
fs::create_dir_all(out_dir)?;
let out = out_dir.join(format!("{}.tar.zst", self.name()));
if out.exists() {
Expand Down

0 comments on commit 25aa19d

Please sign in to comment.