source

spdx_tool

0.4.1

SPDX license detection and management tool

0.4.1

spdx-tool scans the source files to identify licenses and allows to update them in order to use the SPDX license format. It can be used to:

  • identify the license used in source files of a project,
  • produce a JSON/XML report for the licenses found with the list of files,
  • replace a license header by the SPDX license tag equivalent.

Identify licenses used in a project:

spdx-tool

Identify files matching a given license:

spdx-tool --only-licenses=Apache-2.0 -f

Check the license header before replacing it:

spdx-tool --only-licenses=Apache-2.0 --print-license --line-number src

Replace the license header by the SPDX-License-Identifier header:

spdx-tool --only-licenses=Apache-2.0 --update=spdx src

Build an XML or JSON report of files with their licenses:

spdx-tool --output-xml=report.xml

Documentation