Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/docs/pyproject.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ The recommended notation for the most common licenses is (alphabetical):
Optional, but it is highly recommended to supply this.
More identifiers are listed at the [SPDX Open Source License Registry](https://www.spdx.org/licenses/).

!!!note

If your project is proprietary and does not use a specific licence, you can set this value as `Proprietary`.

A custom licence name may also be used here. If used, it will appear as is in your project metadata.

## authors

The authors of the package. **Required**
Expand Down
9 changes: 0 additions & 9 deletions poetry/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,15 +275,6 @@ def validate(

if strict:
# If strict, check the file more thoroughly

# Checking license
license = config.get("license")
if license:
try:
license_by_id(license)
except ValueError:
result["errors"].append("{} is not a valid license".format(license))

if "dependencies" in config:
python_versions = config["dependencies"]["python"]
if python_versions == "*":
Expand Down
4 changes: 3 additions & 1 deletion poetry/spdx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ def license_by_id(identifier):
id = identifier.lower()

if id not in _licenses:
raise ValueError("Invalid license id: {}".format(identifier))
if not identifier:
raise ValueError("A license identifier is required")
return License(identifier, identifier, False, False)

return _licenses[id]

Expand Down
2 changes: 0 additions & 2 deletions tests/console/commands/test_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,12 @@ def test_check_invalid(app, mocker):
if PY2:
expected = """\
Error: u'description' is a required property
Error: INVALID is not a valid license
Warning: A wildcard Python dependency is ambiguous. Consider specifying a more explicit one.
Warning: The "pendulum" dependency specifies the "allows-prereleases" property, which is deprecated. Use "allow-prereleases" instead.
"""
else:
expected = """\
Error: 'description' is a required property
Error: INVALID is not a valid license
Warning: A wildcard Python dependency is ambiguous. Consider specifying a more explicit one.
Warning: The "pendulum" dependency specifies the "allows-prereleases" property, which is deprecated. Use "allow-prereleases" instead.
"""
Expand Down
6 changes: 6 additions & 0 deletions tests/spdx/test_license.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,9 @@ def test_proprietary_license():
license = license_by_id("Proprietary")

assert "License :: Other/Proprietary License" == license.classifier


def test_custom_license():
license = license_by_id("Amazon Software License")

assert "License :: Other/Proprietary License" == license.classifier
11 changes: 10 additions & 1 deletion tests/spdx/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,13 @@ def test_license_by_id_with_full_name():

def test_license_by_id_invalid():
with pytest.raises(ValueError):
license_by_id("invalid")
license_by_id("")


def test_license_by_id_custom():
license = license_by_id("Custom")

assert license.id == "Custom"
assert license.name == "Custom"
assert not license.is_osi_approved
assert not license.is_deprecated