Skip to content

Commit

Permalink
Merge pull request #80 from rust-math/remove-xdg-home-store-feature
Browse files Browse the repository at this point in the history
Remove xdg-data-home experimental feature
  • Loading branch information
termoshtt authored Aug 1, 2022
2 parents fa423c9 + 89f008a commit 389209d
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 33 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ This crate seeks system MKL libraries, e.g. installed by [apt], [yum], or offici
```
pkg-config --libs mkl-dynamic-lp64-iomp
```
- (experimental) Seek `${XDG_DATA_HOME}/intel-mkl-tool`
- Seek a directory set by `${MKLROOT}` environment variable
- Seek default installation path
- `/opt/intel/mkl` for Linux
Expand Down
2 changes: 0 additions & 2 deletions intel-mkl-src/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ mkl-dynamic-ilp64-seq = []

# Enable downloading from AWS S3 when system MKL not found
download = ["intel-mkl-tool/archive"]
# (Experimental) Cache download archive ad $XDG_DATA_HOME/intel-mkl-tool/
xdg-data-home = []

[build-dependencies]
anyhow = "1.0.58"
Expand Down
6 changes: 1 addition & 5 deletions intel-mkl-src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,7 @@ fn main() -> Result<()> {
// download if not found
#[cfg(feature = "download")]
{
let path = if cfg!(feature = "xdg-data-home") {
xdg_home_path()
} else {
PathBuf::from(env::var("OUT_DIR").unwrap())
};
let path = PathBuf::from(env::var("OUT_DIR").unwrap());
println!(
r#"cargo:warning="Download Intel MKL archive into {}""#,
path.display()
Expand Down
9 changes: 2 additions & 7 deletions intel-mkl-tool/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,12 @@ enum Opt {
/// Archive name, e.g. "mkl-static-lp64-iomp". Download all archives if None
#[structopt(long = "name")]
name: Option<String>,
/// Install destination. Default is `$XDG_DATA_HOME/intel-mkl-tool/${MKL_VERSION}/`
/// Install destination
#[structopt(short = "o", long = "path")]
path: Option<PathBuf>,
path: PathBuf,
},

/// Seek Intel-MKL library
///
/// 1. pkg-config
/// 2. `$XDG_DATA_HOME/intel-mkl-tool`
/// will be sought.
Seek {},

/// Package Intel MKL libraries into an archive
Expand All @@ -37,7 +33,6 @@ fn main() -> Result<()> {

match opt {
Opt::Download { name, path } => {
let path = path.unwrap_or(xdg_home_path());
if let Some(name) = name {
let cfg = Config::from_str(&name)?;
cfg.download(&path.join(cfg.to_string()))?;
Expand Down
10 changes: 2 additions & 8 deletions intel-mkl-tool/src/entry.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{mkl, xdg_home_path, Config, LinkType, VALID_CONFIGS};
use crate::{mkl, Config, LinkType, VALID_CONFIGS};
use anyhow::{bail, Result};
use derive_more::Deref;
use std::{
Expand Down Expand Up @@ -72,8 +72,6 @@ impl Entry {
/// - This exists only when the previous build downloads archive here
/// - pkg-config `${name}`
/// - Installed by package manager or official downloader
/// - `$XDG_DATA_HOME/intel-mkl-tool/${name}`
/// - Downloaded by this crate
///
/// Returns error if no library found
///
Expand All @@ -97,10 +95,6 @@ impl Entry {
});
}

// $XDG_DATA_HOME/intel-mkl-tool
let path = xdg_home_path().join(config.to_string());
targets.seek(&path);

// $MKLROOT
let mkl_root = std::env::var("MKLROOT").map(PathBuf::from);
if let Ok(path) = mkl_root {
Expand Down Expand Up @@ -156,7 +150,7 @@ impl Entry {

/// Get MKL version info from its C header
///
/// - This will not work for OUT_DIR, XDG_DATA_HOME, or Pkgconfig entry,
/// - This will not work for OUT_DIR, or Pkgconfig entry,
/// and returns Error in these cases
pub fn version(&self) -> Result<(u32, u32)> {
for (path, _) in &self.found_files() {
Expand Down
10 changes: 0 additions & 10 deletions intel-mkl-tool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@

#![cfg_attr(not(feature = "archive"), allow(dead_code))]

use std::path::PathBuf;

mod config;
mod entry;

Expand Down Expand Up @@ -146,11 +144,3 @@ fn s3_addr() -> String {
mkl::VERSION_UPDATE
)
}

pub fn xdg_home_path() -> PathBuf {
dirs::data_local_dir().unwrap().join(format!(
"intel-mkl-tool/{}.{}",
mkl::VERSION_YEAR,
mkl::VERSION_UPDATE
))
}

0 comments on commit 389209d

Please sign in to comment.