Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove xdg-data-home experimental feature #80

Merged
merged 4 commits into from
Aug 1, 2022
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
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
))
}