Skip to content

[dev] LICENSE THIRD PARTY

Infernio edited this page May 28, 2023 · 9 revisions

The LICENSE-THIRD-PARTY file is needed to satisfy requirements in many third-party dependencies' licenses that require the license text to be preserved.

In the future, we'll also be able to use this file to show license info in an "About" dialog in WB.

Format

Grammar

The format is straightforward. In a simple pseudo-grammar syntax:

LTP := Intro?
       Section+;

Intro := TextLine+;

Section := SectionHeader
           SectionBody;
SectionHeader := SeparatorLine 
                 "::SECTION::" Text Newline
                 SeparatorLine
                 Intro?;
SectionBody := License+;

License := LicenseHeader
           LicenseBody;
LicenseHeader := SeparatorLine
                 "::LICENSE::" Text Newline
                 ("::URL::" Text Newline)?
                 ("::FILES::" Text Newline)?
                 SeparatorLine;
LicenseBody := TextLine+;

# Note: ^ means start of line here
# Also note that these are supposed to be tokenized in order,
# so SeparatorLine would take precedence over TextLine.
Newline := "\r"? "\n";
SeparatorLine := ^"="{5,} Newline;
TextLine := ^Text Newline;
Text := [\w\h]*;

Intro

Let's look at an example. The file starts with an (optional) intro, which is just some text:

Wrye Bash incoporates code from third-party sources. Their licenses are listed here.

To easily navigate this document, search for the '::LICENSE::' markers placed at the start of every license.

Note: Some of the icons in Mopy/bash/images are released under other licenses too - please see the
'Mopy/bash/images/ICON_LICENSES.md' file for their licenses.

See https://github.com/wrye-bash/wrye-bash/wiki/%5Bdev%5D-LICENSE-THIRD-PARTY
for more information on this file and its format.

Sections

Next come one or more sections. Each section consists of a header and a body. Let's look at the header first:

==================================
::SECTION:: Code From Dependencies
==================================

The following third-party sources are required at runtime for Wrye Bash to function.

Each section header consists of a separator (which is a line made up entirely of equal signs, at least five equal signs in length), a ::SECTION:: marker followed by a name for the section, another separator and an optional intro, which functions as a description of the section.

Next comes the section body:

=============================
::LICENSE:: 7Zip
::URL:: https://www.7-zip.org
=============================

  7-Zip
  ~~~~~
  License for use and distribution
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

...

Licenses

Each section body consists of one or more licenses. Let's look at one license in its entirety:

==============================================
::LICENSE:: fomod-schema
::URL:: https://github.com/GandaG/fomod-schema
::FILES:: Mopy/bash/fomod_schema.py
==============================================

MIT License

Copyright (c) 2017 Daniel Nunes

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Each license consists of a license header and a license body. The license body is just some text again, so the interesting thing is the license header:

==============================================
::LICENSE:: fomod-schema
::URL:: https://github.com/GandaG/fomod-schema
::FILES:: Mopy/bash/fomod_schema.py
==============================================

This consists of a separator, a ::LICENSE:: marker that identifies what the license is for, an optional ::URL:: marker that denotes the origin of the dependency and an optional ::FILES:: marker that denotes what files in the project the license applies to (this marker is only relevant for licenses in the Included Code section, see below).

Organizing

Keep dependencies in alphabetical order, sorted by the name you put after ::LICENSE::. Be sure to put them in the right section too (see next part).

Current Sections

  • Code From Dependencies: If the dependency is required at runtime, put it here.
  • Included Code: If we merged the dependency's code entirely into WB's source tree, put it here.
  • Code From Optional Dependencies: If the dependency is not required at runtime but WB will make use of it if it is found at runtime, put it here.
Clone this wiki locally