(#20763) [docs] Add license change explanation

* Add license change entry

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* Manage license attribute

Signed-off-by: Uilian Ries <uilianries@gmail.com>

* Simplify

Signed-off-by: Uilian Ries <uilianries@gmail.com>

---------

Signed-off-by: Uilian Ries <uilianries@gmail.com>
This commit is contained in:
Uilian Ries
2023-10-26 15:01:53 +02:00
committed by GitHub
parent dff4c4fdd2
commit c39277f35c

View File

@@ -57,6 +57,19 @@ The license attribute is a mandatory field which provides the legal information
* `LicenseRef-` as a prefix, followed by the name of the library. For example:`LicenseRef-libfoo-public-domain`
* If the library makes no mention of a license and the terms of use - it **shall not be accepted in ConanCenter** , even if the code is publicly available in GitHub or any other platforms.
In case the license changes in a new release, the recipe should update the license attribute accordingly:
```python
class LibfooConan(ConanFile):
license = ("MIT", "BSD-3-Clause") # keep both old and new licenses, so conan inspect can find it
def configure (self):
# change the license according to the version, so conan graph info can show the correct one
# INFO: Version < 2.0 the license was MIT, but changed to BSD-3-Clause now.
self.license = "BSD-3-Clause" if Version(self.version) >= "2.0.0" else "MIT"
```
## Order of methods and attributes
Prefer the following order of documented methods in python code (`conanfile.py`, `test_package/conanfile.py`):