Crates.io | get-license-helper |
lib.rs | get-license-helper |
version | 0.1.1 |
source | src |
created_at | 2021-04-29 07:09:09.872866 |
updated_at | 2023-01-06 08:53:32.081185 |
description | Help in automatically downloading dependencies license files (using the cargo-license json output). Motivation: help in building conda-forge recipes. |
homepage | |
repository | https://github.com/cds-astro/get-license-helper |
max_upload_size | |
id | 390938 |
size | 57,019 |
Uses the JSON output of cargo-license (cargo license --json
)
to try to find and automatically download your Rust project dependencies license files.
It is based on an heuristic approach, so you may have to download manually licenses not found automatically (especially if a crate does not come from crates.io).
Help in bundling licenses when creating a conda-forge
recipe.
See e.g. the license_file
section of meta.yaml
and the library_licenses
directory in
cdshealpix-feedstock,
(supposedly) mimicking wasmer-feedstock.
First, requires cargo-license :
cargo install cargo-license
Then, install either from a local clone of the repository:
cargo install --path .
or direclty from crates.io:
cargo install get-license-helper
Result of get-license-helper --help
:
get-license-helper 0.1.0
Help in downloading license files from the cargo-license --json output.
USAGE:
get-license-helper [OPTIONS] [input]
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-l <license-dir> Directory storing the licenses [default: library_licenses]
ARGS:
<input> Input file (result of cargo-license --json), stdin if not present
Remark: using twice the same command is faster since already downloaded licenses are not re-downloaded.
In your project directory type:
cargo license --json | get-license-helper
and check the content of the library_licenses
directory.
You can obviously re-direct the output:
cargo license --json | get-license-helper > list.yaml
Change the downloaded licenses output directory:
cargo license --json | get-license-helper -l my_licenses > list.yaml
Or use the saved result of cargo-license
:
cargo license --json > licenses.json
get-license-helper licenses.json -l my_licenses > list.yaml
Ideally, the heuristic should first search in https://docs.rs/crate/${name}/${version}/source/
,
but I don't know if one can download the raw files instead of HTML pages.
So far, we rely on the repositories
:
cargo-license
provided repository
:
github
: look for license(s) in https://raw.githubusercontent.com/${repo}
${repo}
= ${repository}
removing starting https://github.com/
and possible ending .git
gitlab
: look for license(s) in ${repository}/-/raw
removing possible ending .git
to ${repository}
cargo-license
provided license
(split on ' OR ' in case of multiple licenses):
LICENSE-MIT(.txt|.md)
or LICENSE(.txt|.md)
LICENSE-APACHE(.txt|.md)
, LICENSE-Apache(.txt|.md)
or LICENSE(.txt|.md)
LICENSE-BSD(.txt|.md)
or LICENSE(.txt|.md)
LICENSE-BSD(.txt|.md)
or LICENSE(.txt|.md)
LICENSE-ISC(.txt|.md)
or LICENSE(.txt|.md)
LICENSE(.txt|.md)
or LICENCE(.txt|.md)
LICENSE(.txt|.md)
or LICENCE(.txt|.md)
LICENSE-0BSD(.txt|.md)
or LICENCE-0BSD(.txt|.md)
LICENSE-ZLIB(.txt|.md)
or LICENCE-ZLIB(.txt|.md)
LICENSE-BOOST(.txt|.md)
, LICENSE-BST(.txt|.md)
or LICENSE(.txt|.md)
license
, look at the cargo-license
provided license-file
LICENSE(.txt|.md)
async
workers to explore (HTTP queries) n
crates at the same time.Like most projects in Rust, this project is licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.