reuse.download module

Functions for downloading license files from spdx/license-list-data.

reuse.download.download_license(spdx_identifier: str) str[source]

Download the license text from the SPDX repository.

Parameters:

spdx_identifier – SPDX identifier of the license.

Raises:

URLError – if the license could not be downloaded.

Returns:

The license text.

reuse.download.put_license_in_file(spdx_identifier: str, destination: str | PathLike, source: str | PathLike | None = None) None[source]

Download a license and put it in the destination file.

This function exists solely for convenience.

Parameters:
  • spdx_identifier – SPDX License Identifier of the license.

  • destination – Where to put the license.

  • source – Path to file or directory containing the text for LicenseRef licenses.

Raises:
  • URLError – if the license could not be downloaded.

  • FileExistsError – if the license file already exists.

  • FileNotFoundError – if the source could not be found in the directory.

reuse.download.add_arguments(parser: ArgumentParser) None[source]

Add arguments to parser.

reuse.download.run(args: ~argparse.Namespace, project: ~reuse.project.Project, out: ~typing.IO[str] = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>) int[source]

Download license and place it in the LICENSES/ directory.