Skip to content

Commit

Permalink
Update generated model after licensing changes in spec
Browse files Browse the repository at this point in the history
Signed-off-by: Holger Frydrych <[email protected]>
  • Loading branch information
fholger authored and armintaenzertng committed Aug 22, 2023
1 parent 9364581 commit e866f96
Show file tree
Hide file tree
Showing 21 changed files with 1,956 additions and 1,920 deletions.
3,690 changes: 1,855 additions & 1,835 deletions dev/model_dump.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/spdx_tools/spdx3/new_model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
# Do not manually edit!
# flake8: noqa

from . import expanded_license, core, dataset, licensing, ai, security, build, software
from . import expanded_licensing, core, dataset, ai, security, build, software, simple_licensing
from .core import *
20 changes: 14 additions & 6 deletions src/spdx_tools/spdx3/new_model/core/profile_identifier_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ class ProfileIdentifierType(Enum):
"""
the element follows the Software profile specification
"""
LICENSING = auto()
SIMPLE_LICENSING = auto()
"""
the element follows the Licensing profile specification
the element follows the simple Licensing profile specification
"""
EXPANDED_LICENSING = auto()
"""
the element follows the expanded Licensing profile specification
"""
SECURITY = auto()
"""
Expand Down Expand Up @@ -57,8 +61,10 @@ def __str__(self) -> str:
return "core"
if self == ProfileIdentifierType.SOFTWARE:
return "software"
if self == ProfileIdentifierType.LICENSING:
return "licensing"
if self == ProfileIdentifierType.SIMPLE_LICENSING:
return "simpleLicensing"
if self == ProfileIdentifierType.EXPANDED_LICENSING:
return "expandedLicensing"
if self == ProfileIdentifierType.SECURITY:
return "security"
if self == ProfileIdentifierType.BUILD:
Expand All @@ -79,8 +85,10 @@ def from_str(value: str) -> Optional["ProfileIdentifierType"]:
return ProfileIdentifierType.CORE
if value == "software":
return ProfileIdentifierType.SOFTWARE
if value == "licensing":
return ProfileIdentifierType.LICENSING
if value == "simpleLicensing":
return ProfileIdentifierType.SIMPLE_LICENSING
if value == "expandedLicensing":
return ProfileIdentifierType.EXPANDED_LICENSING
if value == "security":
return ProfileIdentifierType.SECURITY
if value == "build":
Expand Down
2 changes: 1 addition & 1 deletion src/spdx_tools/spdx3/new_model/dataset/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
from spdx_tools.common.typing.dataclass_with_properties import dataclass_with_properties
from spdx_tools.common.typing.type_checks import check_types_and_set_values

from ..ai.presence_type import PresenceType
from ..core.creation_info import CreationInfo
from ..core.external_identifier import ExternalIdentifier
from ..core.external_reference import ExternalReference
from ..core.integrity_method import IntegrityMethod
from ..dataset.confidentiality_level_type import ConfidentialityLevelType
from ..dataset.dataset_availability_type import DatasetAvailabilityType
from ..dataset.dataset_type import DatasetType
from ..dataset.presence_type import PresenceType
from ..licensing.any_license_info import AnyLicenseInfo
from ..software.package import Package
from ..software.software_purpose import SoftwarePurpose
Expand Down
9 changes: 0 additions & 9 deletions src/spdx_tools/spdx3/new_model/expanded_license/__init__.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
# Do not manually edit!
# flake8: noqa

from .any_license_info import AnyLicenseInfo
from .conjunctive_license_set import ConjunctiveLicenseSet
from .custom_license import CustomLicense
from .custom_license_addition import CustomLicenseAddition
from .disjunctive_license_set import DisjunctiveLicenseSet
from .extendable_license import ExtendableLicense
from .license import License
from .license_addition import LicenseAddition
from .license_expression import LicenseExpression
from .listed_license import ListedLicense
from .listed_license_exception import ListedLicenseException
from .or_later_operator import OrLaterOperator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from ..core.external_identifier import ExternalIdentifier
from ..core.external_reference import ExternalReference
from ..core.integrity_method import IntegrityMethod
from ..licensing.any_license_info import AnyLicenseInfo
from ..simple_licensing.any_license_info import AnyLicenseInfo


@dataclass_with_properties
Expand All @@ -33,8 +33,8 @@ class ConjunctiveLicenseSet(AnyLicenseInfo):

member: List[AnyLicenseInfo] = field(default_factory=list)
"""
A member is a license expression participating in a conjuctive (of type ConjunctiveLicenseSet) or a disjunctive (of
type DisjunctiveLicenseSet) license set.
A member is a license expression participating in a conjunctive (of type ConjunctiveLicenseSet) or a disjunctive
(of type DisjunctiveLicenseSet) license set.
"""

def __init__(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# SPDX-License-Identifier: Apache-2.0
#
# This file was auto-generated by dev/gen_python_model_from_spec.py
# Do not manually edit!
# flake8: noqa

from beartype.typing import Optional

from spdx_tools.common.typing.dataclass_with_properties import dataclass_with_properties
from spdx_tools.common.typing.type_checks import check_types_and_set_values

from ..expanded_licensing.license import License


@dataclass_with_properties
class CustomLicense(License):
"""
A CustomLicense represents a License that is not listed on the SPDX License List at https://spdx.org/licenses, and
is therefore defined by an SPDX data creator.
"""

def __init__(
self,
license_text: str,
is_osi_approved: Optional[bool] = None,
is_fsf_libre: Optional[bool] = None,
standard_license_header: Optional[str] = None,
standard_license_template: Optional[str] = None,
is_deprecated_license_id: Optional[bool] = None,
obsoleted_by: Optional[str] = None,
):
check_types_and_set_values(self, locals())
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from ..core.external_identifier import ExternalIdentifier
from ..core.external_reference import ExternalReference
from ..core.integrity_method import IntegrityMethod
from ..licensing.license_addition import LicenseAddition
from ..expanded_licensing.license_addition import LicenseAddition


@dataclass_with_properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from ..core.external_identifier import ExternalIdentifier
from ..core.external_reference import ExternalReference
from ..core.integrity_method import IntegrityMethod
from ..licensing.any_license_info import AnyLicenseInfo
from ..simple_licensing.any_license_info import AnyLicenseInfo


@dataclass_with_properties
Expand All @@ -30,8 +30,8 @@ class DisjunctiveLicenseSet(AnyLicenseInfo):

member: List[AnyLicenseInfo] = field(default_factory=list)
"""
A member is a license expression participating in a conjuctive (of type ConjunctiveLicenseSet) or a disjunctive (of
type DisjunctiveLicenseSet) license set.
A member is a license expression participating in a conjunctive (of type ConjunctiveLicenseSet) or a disjunctive
(of type DisjunctiveLicenseSet) license set.
"""

def __init__(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from spdx_tools.common.typing.dataclass_with_properties import dataclass_with_properties

from ..expanded_license.extendable_license import ExtendableLicense
from ..expanded_licensing.extendable_license import ExtendableLicense


@dataclass_with_properties
Expand All @@ -22,7 +22,7 @@ class License(ExtendableLicense):

license_text: str = None
"""
A licenseText contains the plain text of the License, without templating or other similar markup.
A licenseText contains the plain text of the License or Addition, without templating or other similar markup.
Users of the licenseText for a License can apply the SPDX Matching Guidelines when comparing it to another text for
matching purposes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@
# Do not manually edit!
# flake8: noqa

from beartype.typing import List, Optional
from beartype.typing import Optional

from spdx_tools.common.typing.dataclass_with_properties import dataclass_with_properties
from spdx_tools.common.typing.type_checks import check_types_and_set_values

from ..core.creation_info import CreationInfo
from ..core.external_identifier import ExternalIdentifier
from ..core.external_reference import ExternalReference
from ..core.integrity_method import IntegrityMethod
from ..licensing.license import License
from ..expanded_licensing.license import License


@dataclass_with_properties
Expand All @@ -35,17 +31,7 @@ class ListedLicense(License):

def __init__(
self,
spdx_id: str,
creation_info: CreationInfo,
license_text: str,
name: Optional[str] = None,
summary: Optional[str] = None,
description: Optional[str] = None,
comment: Optional[str] = None,
verified_using: List[IntegrityMethod] = None,
external_reference: List[ExternalReference] = None,
external_identifier: List[ExternalIdentifier] = None,
extension: List[str] = None,
is_osi_approved: Optional[bool] = None,
is_fsf_libre: Optional[bool] = None,
standard_license_header: Optional[str] = None,
Expand All @@ -55,8 +41,4 @@ def __init__(
list_version_added: Optional[str] = None,
deprecated_version: Optional[str] = None,
):
verified_using = [] if verified_using is None else verified_using
external_reference = [] if external_reference is None else external_reference
external_identifier = [] if external_identifier is None else external_identifier
extension = [] if extension is None else extension
check_types_and_set_values(self, locals())
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from ..core.external_identifier import ExternalIdentifier
from ..core.external_reference import ExternalReference
from ..core.integrity_method import IntegrityMethod
from ..licensing.license_addition import LicenseAddition
from ..expanded_licensing.license_addition import LicenseAddition


@dataclass_with_properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,11 @@
# Do not manually edit!
# flake8: noqa

from beartype.typing import List, Optional

from spdx_tools.common.typing.dataclass_with_properties import dataclass_with_properties
from spdx_tools.common.typing.type_checks import check_types_and_set_values

from ..core.creation_info import CreationInfo
from ..core.external_identifier import ExternalIdentifier
from ..core.external_reference import ExternalReference
from ..core.integrity_method import IntegrityMethod
from ..expanded_license.extendable_license import ExtendableLicense
from ..licensing.license import License
from ..expanded_licensing.extendable_license import ExtendableLicense
from ..expanded_licensing.license import License


@dataclass_with_properties
Expand All @@ -31,23 +25,13 @@ class OrLaterOperator(ExtendableLicense):
"""

subject_license: License = None
"""
A subjectLicense is a License which is subject to either an 'or later' effect (OrLaterOperator) or a 'with
additional text' effect (WithAdditionOperator).
"""

def __init__(
self,
spdx_id: str,
creation_info: CreationInfo,
subject_license: License,
name: Optional[str] = None,
summary: Optional[str] = None,
description: Optional[str] = None,
comment: Optional[str] = None,
verified_using: List[IntegrityMethod] = None,
external_reference: List[ExternalReference] = None,
external_identifier: List[ExternalIdentifier] = None,
extension: List[str] = None,
):
verified_using = [] if verified_using is None else verified_using
external_reference = [] if external_reference is None else external_reference
external_identifier = [] if external_identifier is None else external_identifier
extension = [] if extension is None else extension
check_types_and_set_values(self, locals())
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
from ..core.external_identifier import ExternalIdentifier
from ..core.external_reference import ExternalReference
from ..core.integrity_method import IntegrityMethod
from ..expanded_license.extendable_license import ExtendableLicense
from ..licensing.any_license_info import AnyLicenseInfo
from ..licensing.license_addition import LicenseAddition
from ..expanded_licensing.extendable_license import ExtendableLicense
from ..expanded_licensing.license_addition import LicenseAddition
from ..simple_licensing.any_license_info import AnyLicenseInfo


@dataclass_with_properties
Expand All @@ -27,7 +27,14 @@ class WithAdditionOperator(AnyLicenseInfo):
"""

subject_license: ExtendableLicense = None
"""
A subjectLicense is a License which is subject to either an 'or later' effect (OrLaterOperator) or a 'with
additional text' effect (WithAdditionOperator).
"""
subject_addition: LicenseAddition = None
"""
A subjectAddition is a LicenseAddition which is subject to a 'with additional text' effect (WithAdditionOperator).
"""

def __init__(
self,
Expand Down
9 changes: 9 additions & 0 deletions src/spdx_tools/spdx3/new_model/simple_licensing/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# SPDX-License-Identifier: Apache-2.0
#
# This file was auto-generated by dev/gen_python_model_from_spec.py
# Do not manually edit!
# flake8: noqa

from .any_license_info import AnyLicenseInfo
from .license_expression import LicenseExpression
from .simple_licensing_text import SimpleLicensingText
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from ..core.external_identifier import ExternalIdentifier
from ..core.external_reference import ExternalReference
from ..core.integrity_method import IntegrityMethod
from ..licensing.any_license_info import AnyLicenseInfo
from ..simple_licensing.any_license_info import AnyLicenseInfo


@dataclass_with_properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,25 @@
from spdx_tools.common.typing.type_checks import check_types_and_set_values

from ..core.creation_info import CreationInfo
from ..core.element import Element
from ..core.external_identifier import ExternalIdentifier
from ..core.external_reference import ExternalReference
from ..core.integrity_method import IntegrityMethod
from ..licensing.license import License


@dataclass_with_properties
class CustomLicense(License):
class SimpleLicensingText(Element):
"""
A CustomLicense represents a License that is not listed on the SPDX License List at https://spdx.org/licenses, and
is therefore defined by an SPDX data creator.
A SimpleLicensingText represents a License or Addition that is not listed on the SPDX License List at
https://spdx.org/licenses, and is therefore defined by an SPDX data creator.
"""

license_text: str = None
"""
A licenseText contains the plain text of the License or Addition, without templating or other similar markup.
Users of the licenseText for a License can apply the SPDX Matching Guidelines when comparing it to another text for
matching purposes.
"""

def __init__(
Expand All @@ -36,12 +44,6 @@ def __init__(
external_reference: List[ExternalReference] = None,
external_identifier: List[ExternalIdentifier] = None,
extension: List[str] = None,
is_osi_approved: Optional[bool] = None,
is_fsf_libre: Optional[bool] = None,
standard_license_header: Optional[str] = None,
standard_license_template: Optional[str] = None,
is_deprecated_license_id: Optional[bool] = None,
obsoleted_by: Optional[str] = None,
):
verified_using = [] if verified_using is None else verified_using
external_reference = [] if external_reference is None else external_reference
Expand Down

0 comments on commit e866f96

Please sign in to comment.