Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[issue_592] add top-level package #595

Merged
merged 1 commit into from
Apr 19, 2023
Merged
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
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[flake8]
max-line-length = 119
exclude = src/spdx/parser/tagvalue/parsetab.py
exclude = src/spdx_tools/spdx/parser/tagvalue/parsetab.py
extend-ignore = E203
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ __pycache__/
/build/
/dist/
/tmp/
src/spdx/parser/tagvalue/parsetab.py
src/spdx_tools/spdx/parser/tagvalue/parsetab.py
/.cache/

.tox
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ import logging

from license_expression import get_spdx_licensing

from spdx.model.checksum import Checksum, ChecksumAlgorithm
from spdx.model.file import File, FileType
from spdx.model.relationship import Relationship, RelationshipType
from spdx.parser.parse_anything import parse_file
from spdx.validation.document_validator import validate_full_spdx_document
from spdx.writer.write_anything import write_file
from spdx_tools.spdx.model.checksum import Checksum, ChecksumAlgorithm
from spdx_tools.spdx.model.file import File, FileType
from spdx_tools.spdx.model.relationship import Relationship, RelationshipType
from spdx_tools.spdx.parser.parse_anything import parse_file
from spdx_tools.spdx.validation.document_validator import validate_full_spdx_document
from spdx_tools.spdx.writer.write_anything import write_file

# read in an SPDX document from a file
document = parse_file("spdx_document.json")
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ graph_generation = ["pygraphviz", "networkx"]
development = ["black", "flake8", "isort", "networkx", "pytest"]

[project.scripts]
pyspdxtools = "spdx.clitools.pyspdxtools:main"
pyspdxtools = "spdx_tools.spdx.clitools.pyspdxtools:main"

[tool.setuptools]
zip-safe = false # because of the uses of __file__: https://github.com/spdx/tools-python/issues/257
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Any, Dict

from common.typing.constructor_type_errors import ConstructorTypeErrors
from spdx_tools.common.typing.constructor_type_errors import ConstructorTypeErrors


def check_types_and_set_values(instance_under_construction: Any, local_variables: Dict) -> None:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@

import click

from spdx.graph_generation import export_graph_from_document
from spdx.model.document import Document
from spdx.parser.error import SPDXParsingError
from spdx.parser.parse_anything import parse_file
from spdx.validation.document_validator import validate_full_spdx_document
from spdx.validation.validation_message import ValidationMessage
from spdx.writer.tagvalue import tagvalue_writer
from spdx.writer.write_anything import write_file
from spdx_tools.spdx.graph_generation import export_graph_from_document
from spdx_tools.spdx.model.document import Document
from spdx_tools.spdx.parser.error import SPDXParsingError
from spdx_tools.spdx.parser.parse_anything import parse_file
from spdx_tools.spdx.validation.document_validator import validate_full_spdx_document
from spdx_tools.spdx.validation.validation_message import ValidationMessage
from spdx_tools.spdx.writer.tagvalue import tagvalue_writer
from spdx_tools.spdx.writer.write_anything import write_file


@click.command()
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
from copy import deepcopy
from typing import Any, Dict, List, Union

from spdx.model.document import Document
from spdx.model.file import File
from spdx.model.package import Package
from spdx.model.snippet import Snippet
from spdx_tools.spdx.model.document import Document
from spdx_tools.spdx.model.file import File
from spdx_tools.spdx.model.package import Package
from spdx_tools.spdx.model.snippet import Snippet


def get_contained_spdx_element_ids(document: Document) -> List[str]:
Expand Down
2 changes: 1 addition & 1 deletion src/spdx/formats.py → src/spdx_tools/spdx/formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: Apache-2.0
from enum import Enum, auto

from spdx.parser.error import SPDXParsingError
from spdx_tools.spdx.parser.error import SPDXParsingError


class FileFormat(Enum):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
# SPDX-License-Identifier: Apache-2.0
from typing import Dict, List, Union

from spdx.model.file import File
from spdx.model.package import Package
from spdx.model.snippet import Snippet
from spdx_tools.spdx.model.file import File
from spdx_tools.spdx.model.package import Package
from spdx_tools.spdx.model.snippet import Snippet

try:
from networkx import DiGraph
except ImportError:
DiGraph = None
from spdx.document_utils import get_contained_spdx_elements
from spdx.model.document import Document
from spdx.model.relationship import Relationship
from spdx_tools.spdx.document_utils import get_contained_spdx_elements
from spdx_tools.spdx.model.document import Document
from spdx_tools.spdx.model.relationship import Relationship


def export_graph_from_document(document: Document, file_name: str) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
# SPDX-License-Identifier: Apache-2.0
from typing import Any, Type

from spdx.datetime_conversions import datetime_to_iso_string
from spdx.jsonschema.annotation_properties import AnnotationProperty
from spdx.jsonschema.converter import TypedConverter
from spdx.jsonschema.json_property import JsonProperty
from spdx.model.annotation import Annotation
from spdx.model.document import Document
from spdx_tools.spdx.datetime_conversions import datetime_to_iso_string
from spdx_tools.spdx.jsonschema.annotation_properties import AnnotationProperty
from spdx_tools.spdx.jsonschema.converter import TypedConverter
from spdx_tools.spdx.jsonschema.json_property import JsonProperty
from spdx_tools.spdx.model.annotation import Annotation
from spdx_tools.spdx.model.document import Document


class AnnotationConverter(TypedConverter[Annotation]):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: Apache-2.0
from enum import auto

from spdx.jsonschema.json_property import JsonProperty
from spdx_tools.spdx.jsonschema.json_property import JsonProperty


class AnnotationProperty(JsonProperty):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
# SPDX-License-Identifier: Apache-2.0
from typing import Type

from spdx.jsonschema.checksum_properties import ChecksumProperty
from spdx.jsonschema.converter import TypedConverter
from spdx.jsonschema.json_property import JsonProperty
from spdx.model.checksum import Checksum, ChecksumAlgorithm
from spdx.model.document import Document
from spdx_tools.spdx.jsonschema.checksum_properties import ChecksumProperty
from spdx_tools.spdx.jsonschema.converter import TypedConverter
from spdx_tools.spdx.jsonschema.json_property import JsonProperty
from spdx_tools.spdx.model.checksum import Checksum, ChecksumAlgorithm
from spdx_tools.spdx.model.document import Document


class ChecksumConverter(TypedConverter[Checksum]):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: Apache-2.0
from enum import auto

from spdx.jsonschema.json_property import JsonProperty
from spdx_tools.spdx.jsonschema.json_property import JsonProperty


class ChecksumProperty(JsonProperty):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from abc import ABC, abstractmethod
from typing import Any, Dict, Generic, Type, TypeVar

from spdx.casing_tools import snake_case_to_camel_case
from spdx.jsonschema.json_property import JsonProperty
from spdx.model.document import Document
from spdx_tools.spdx.casing_tools import snake_case_to_camel_case
from spdx_tools.spdx.jsonschema.json_property import JsonProperty
from spdx_tools.spdx.model.document import Document

MISSING_IMPLEMENTATION_MESSAGE = "Must be implemented"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
# SPDX-License-Identifier: Apache-2.0
from typing import Any, Type

from spdx.datetime_conversions import datetime_to_iso_string
from spdx.jsonschema.converter import TypedConverter
from spdx.jsonschema.creation_info_properties import CreationInfoProperty
from spdx.jsonschema.json_property import JsonProperty
from spdx.jsonschema.optional_utils import apply_if_present
from spdx.model.document import CreationInfo, Document
from spdx_tools.spdx.datetime_conversions import datetime_to_iso_string
from spdx_tools.spdx.jsonschema.converter import TypedConverter
from spdx_tools.spdx.jsonschema.creation_info_properties import CreationInfoProperty
from spdx_tools.spdx.jsonschema.json_property import JsonProperty
from spdx_tools.spdx.jsonschema.optional_utils import apply_if_present
from spdx_tools.spdx.model.document import CreationInfo, Document


class CreationInfoConverter(TypedConverter[CreationInfo]):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: Apache-2.0
from enum import auto

from spdx.jsonschema.json_property import JsonProperty
from spdx_tools.spdx.jsonschema.json_property import JsonProperty


class CreationInfoProperty(JsonProperty):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
# SPDX-License-Identifier: Apache-2.0
from typing import Any, Type

from spdx.document_utils import get_contained_spdx_element_ids
from spdx.jsonschema.annotation_converter import AnnotationConverter
from spdx.jsonschema.converter import TypedConverter
from spdx.jsonschema.creation_info_converter import CreationInfoConverter
from spdx.jsonschema.document_properties import DocumentProperty
from spdx.jsonschema.external_document_ref_converter import ExternalDocumentRefConverter
from spdx.jsonschema.extracted_licensing_info_converter import ExtractedLicensingInfoConverter
from spdx.jsonschema.file_converter import FileConverter
from spdx.jsonschema.json_property import JsonProperty
from spdx.jsonschema.package_converter import PackageConverter
from spdx.jsonschema.relationship_converter import RelationshipConverter
from spdx.jsonschema.snippet_converter import SnippetConverter
from spdx.model.document import Document
from spdx_tools.spdx.document_utils import get_contained_spdx_element_ids
from spdx_tools.spdx.jsonschema.annotation_converter import AnnotationConverter
from spdx_tools.spdx.jsonschema.converter import TypedConverter
from spdx_tools.spdx.jsonschema.creation_info_converter import CreationInfoConverter
from spdx_tools.spdx.jsonschema.document_properties import DocumentProperty
from spdx_tools.spdx.jsonschema.external_document_ref_converter import ExternalDocumentRefConverter
from spdx_tools.spdx.jsonschema.extracted_licensing_info_converter import ExtractedLicensingInfoConverter
from spdx_tools.spdx.jsonschema.file_converter import FileConverter
from spdx_tools.spdx.jsonschema.json_property import JsonProperty
from spdx_tools.spdx.jsonschema.package_converter import PackageConverter
from spdx_tools.spdx.jsonschema.relationship_converter import RelationshipConverter
from spdx_tools.spdx.jsonschema.snippet_converter import SnippetConverter
from spdx_tools.spdx.model.document import Document


class DocumentConverter(TypedConverter[Document]):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: Apache-2.0
from enum import auto

from spdx.jsonschema.json_property import JsonProperty
from spdx_tools.spdx.jsonschema.json_property import JsonProperty


class DocumentProperty(JsonProperty):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
# SPDX-License-Identifier: Apache-2.0
from typing import Any, Type

from spdx.jsonschema.checksum_converter import ChecksumConverter
from spdx.jsonschema.converter import TypedConverter
from spdx.jsonschema.external_document_ref_properties import ExternalDocumentRefProperty
from spdx.jsonschema.json_property import JsonProperty
from spdx.model.document import Document
from spdx.model.external_document_ref import ExternalDocumentRef
from spdx_tools.spdx.jsonschema.checksum_converter import ChecksumConverter
from spdx_tools.spdx.jsonschema.converter import TypedConverter
from spdx_tools.spdx.jsonschema.external_document_ref_properties import ExternalDocumentRefProperty
from spdx_tools.spdx.jsonschema.json_property import JsonProperty
from spdx_tools.spdx.model.document import Document
from spdx_tools.spdx.model.external_document_ref import ExternalDocumentRef


class ExternalDocumentRefConverter(TypedConverter[ExternalDocumentRef]):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: Apache-2.0
from enum import auto

from spdx.jsonschema.json_property import JsonProperty
from spdx_tools.spdx.jsonschema.json_property import JsonProperty


class ExternalDocumentRefProperty(JsonProperty):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
# SPDX-License-Identifier: Apache-2.0
from typing import Any, Type

from spdx.jsonschema.converter import TypedConverter
from spdx.jsonschema.external_package_ref_properties import ExternalPackageRefProperty
from spdx.jsonschema.json_property import JsonProperty
from spdx.model.document import Document
from spdx.model.package import ExternalPackageRef
from spdx_tools.spdx.jsonschema.converter import TypedConverter
from spdx_tools.spdx.jsonschema.external_package_ref_properties import ExternalPackageRefProperty
from spdx_tools.spdx.jsonschema.json_property import JsonProperty
from spdx_tools.spdx.model.document import Document
from spdx_tools.spdx.model.package import ExternalPackageRef


class ExternalPackageRefConverter(TypedConverter[ExternalPackageRef]):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: Apache-2.0
from enum import auto

from spdx.jsonschema.json_property import JsonProperty
from spdx_tools.spdx.jsonschema.json_property import JsonProperty


class ExternalPackageRefProperty(JsonProperty):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
# SPDX-License-Identifier: Apache-2.0
from typing import Any, Type

from spdx.jsonschema.converter import TypedConverter
from spdx.jsonschema.extracted_licensing_info_properties import ExtractedLicensingInfoProperty
from spdx.jsonschema.json_property import JsonProperty
from spdx.jsonschema.optional_utils import apply_if_present
from spdx.model.document import Document
from spdx.model.extracted_licensing_info import ExtractedLicensingInfo
from spdx_tools.spdx.jsonschema.converter import TypedConverter
from spdx_tools.spdx.jsonschema.extracted_licensing_info_properties import ExtractedLicensingInfoProperty
from spdx_tools.spdx.jsonschema.json_property import JsonProperty
from spdx_tools.spdx.jsonschema.optional_utils import apply_if_present
from spdx_tools.spdx.model.document import Document
from spdx_tools.spdx.model.extracted_licensing_info import ExtractedLicensingInfo


class ExtractedLicensingInfoConverter(TypedConverter[ExtractedLicensingInfo]):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: Apache-2.0
from enum import auto

from spdx.jsonschema.json_property import JsonProperty
from spdx_tools.spdx.jsonschema.json_property import JsonProperty


class ExtractedLicensingInfoProperty(JsonProperty):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
# SPDX-License-Identifier: Apache-2.0
from typing import Any, Type

from spdx.jsonschema.annotation_converter import AnnotationConverter
from spdx.jsonschema.checksum_converter import ChecksumConverter
from spdx.jsonschema.converter import TypedConverter
from spdx.jsonschema.file_properties import FileProperty
from spdx.jsonschema.json_property import JsonProperty
from spdx.jsonschema.optional_utils import apply_if_present
from spdx.model.document import Document
from spdx.model.file import File
from spdx_tools.spdx.jsonschema.annotation_converter import AnnotationConverter
from spdx_tools.spdx.jsonschema.checksum_converter import ChecksumConverter
from spdx_tools.spdx.jsonschema.converter import TypedConverter
from spdx_tools.spdx.jsonschema.file_properties import FileProperty
from spdx_tools.spdx.jsonschema.json_property import JsonProperty
from spdx_tools.spdx.jsonschema.optional_utils import apply_if_present
from spdx_tools.spdx.model.document import Document
from spdx_tools.spdx.model.file import File


class FileConverter(TypedConverter[File]):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: Apache-2.0
from enum import auto

from spdx.jsonschema.json_property import JsonProperty
from spdx_tools.spdx.jsonschema.json_property import JsonProperty


class FileProperty(JsonProperty):
Expand Down
Loading