Skip to content
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 .coveragerc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[run]
omit = uprotocol/proto/*, uprotocol/cloudevent/*_pb2.py, tests/*, */__init__.py
omit = uprotocol/core/*,uprotocol/v1/*, uprotocol/uoptions_pb2.py, uprotocol/cloudevent/*_pb2.py, tests/*, */__init__.py
[report]
exclude_lines =
pragma: no cover
Expand Down
8 changes: 6 additions & 2 deletions .github/ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ exclude = [
".venv/",
"__pycache__/",
"uprotocol/cloudevent/cloudevents_pb2.py",
"uprotocol/proto/*"
"uprotocol/core/*",
"uprotocol/v1/*",
"uprotocol/uoptions_pb2.py"

]

[lint]
Expand All @@ -25,6 +28,7 @@ select = [

ignore = [
"F811", # Ignore the error for multimethod function
"N999" # Invalid module name: 'up-python'
]

[lint.flake8-annotations]
Expand All @@ -34,4 +38,4 @@ allow-star-arg-any = true
quote-style = "preserve"
indent-style = "space"
docstring-code-format = true
docstring-code-line-length = 100
docstring-code-line-length = 100
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
.vscode
.coverage
target
#**/proto
#uprotocol/core
#uprotocol/v1
#uprotocol/uoptions_pb2.py
poetry.lock
htmlcov
coverage_report.txt
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ packages = [{ include = "uprotocol" },
[tool.poetry.dependencies]
python = "^3.8"
cloudevents = "*"
multimethod = "*"
gitpython = ">=3.1.41"
googleapis-common-protos = ">=1.56.4"
protobuf = "4.24.2"
Expand Down
35 changes: 7 additions & 28 deletions scripts/pull_and_compile_protos.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
"""
SPDX-FileCopyrightText: Copyright (c) 2023 Contributors to the
Eclipse Foundation
SPDX-FileCopyrightText: 2023 Contributors to the Eclipse Foundation

See the NOTICE file(s) distributed with this work for additional
information regarding copyright ownership.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
This program and the accompanying materials are made available under the
terms of the Apache License Version 2.0 which is available at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
SPDX-FileType: SOURCE
SPDX-License-Identifier: Apache-2.0
"""

Expand All @@ -28,10 +20,10 @@
import git
from git import Repo

REPO_URL = "https://github.com/eclipse-uprotocol/up-core-api.git"
REPO_URL = "https://github.com/eclipse-uprotocol/up-spec.git"
PROTO_REPO_DIR = os.path.abspath("../target")
TAG_NAME = "uprotocol-core-api-1.5.7"
PROTO_OUTPUT_DIR = os.path.abspath("../uprotocol/proto")
TAG_NAME = "main"
PROTO_OUTPUT_DIR = os.path.abspath("../uprotocol/")


def clone_or_pull(repo_url, proto_repo_dir):
Expand Down Expand Up @@ -67,7 +59,7 @@ def execute_maven_command(project_dir, command):
else:
print("Maven command executed successfully.")
src_directory = os.path.join(
os.getcwd(), project_dir, "target", "generated-sources", "protobuf", "python"
os.getcwd(), project_dir, "target", "generated-sources", "protobuf", "python", "uprotocol"
)

shutil.copytree(src_directory, PROTO_OUTPUT_DIR, dirs_exist_ok=True)
Expand All @@ -89,19 +81,6 @@ def replace_in_file(file_path, search_pattern, replace_pattern):
def process_python_protofiles(directory):
for root, dirs, files in os.walk(directory):
create_init_py(root)
for file in files:
if file.endswith('.py'):
file_path = os.path.join(root, file)
replace_in_file(file_path, r'import uri_pb2', 'import uprotocol.proto.uri_pb2')
replace_in_file(file_path, r'import uuid_pb2', 'import uprotocol.proto.uuid_pb2')
replace_in_file(
file_path, r'import uprotocol_options_pb2', 'import uprotocol.proto.uprotocol_options_pb2'
)
replace_in_file(file_path, r'import uattributes_pb2', 'import uprotocol.proto.uattributes_pb2')
replace_in_file(file_path, r'import upayload_pb2', 'import uprotocol.proto.upayload_pb2')
replace_in_file(file_path, r'import ustatus_pb2', 'import uprotocol.proto.ustatus_pb2')
replace_in_file(file_path, r'import upayload_pb2', 'import uprotocol.proto.upayload_pb2')
replace_in_file(file_path, r'import umessage_pb2', 'import uprotocol.proto.umessage_pb2')


def create_init_py(directory):
Expand Down
Loading