Skip to content
πŸ†” Helper crate for SPDX expressions. πŸ¦€
Rust
Branch: master
Clone or download
Jake-Shadle Update to v3.7 of the SPDX license list (#13)
* Update to v3.7 of the SPDX license list
* Prep 0.2.3
Latest commit 661e3d2 Nov 7, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Release 0.2.1 (#10) Oct 21, 2019
src
tests Add `LicenseId::full_name` (#11) Nov 6, 2019
update
.gitignore
.mergify.yml
CHANGELOG.md Update to v3.7 of the SPDX license list (#13) Nov 7, 2019
CODE_OF_CONDUCT.md
CONTRIBUTING.md Initial commit Sep 2, 2019
Cargo.toml Update to v3.7 of the SPDX license list (#13) Nov 7, 2019
LICENSE-APACHE
LICENSE-MIT Initial commit Sep 2, 2019
README.md Update to v3.7 of the SPDX license list (#13) Nov 7, 2019

README.md

πŸ†” spdx

Build Status Crates.io Docs SPDX Version Contributor Covenant Embark

Helper crate for SPDX license expressions.

Usage

use spdx::Expression;

fn main() {
    let this_is_fine = Expression::parse("MIT OR Apache-2.0").unwrap();

    assert!(this_is_fine.evaluate(|req| {
        if let spdx::LicenseItem::SPDX { id, .. } = req.license {
            // Both MIT and Apache-2.0 are OSI approved, so this expression
            // evaluates to true
            return id.is_osi_approved();
        }

        false
    }));

    assert!(!this_is_fine.evaluate(|req| {
        if let spdx::LicenseItem::SPDX { id, .. } = req.license {
            // This is saying we don't accept any licenses that are OSI approved
            // so the expression will evaluate to false as both sides of the OR
            // are now rejected
            return !id.is_osi_approved();
        }

        false
    }));

    // `NOPE` is not a valid SPDX license identifier, so this expression
    // will fail to parse
    let _this_is_not = Expression::parse("MIT OR NOPE").unwrap_err();
}

Updating SPDX list

You can update the list of SPDX identifiers for licenses and exceptions by running the update program cargo run --manifest-path=update/Cargo.toml -- v3.6 where v3.6 is the tag in the SPDX data repo.

Contributing

We welcome community contributions to this project.

Please read our Contributor Guide for more information on how to get started.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

You can’t perform that action at this time.