From 4a893d73dc9fcd7db3d782dbd729e01e011b551c Mon Sep 17 00:00:00 2001 From: Ernesto Puerta Date: Fri, 11 Aug 2023 10:27:43 +0200 Subject: [PATCH] fix(package): move proto dir inside control Fixes: #178 Signed-off-by: Ernesto Puerta --- .dockerignore | 2 +- .env | 2 +- Dockerfile | 3 +-- control/cli.py | 4 ++-- control/grpc.py | 4 ++-- control/proto/__init__.py | 0 {proto => control/proto}/gateway.proto | 0 control/server.py | 4 ++-- pyproject.toml | 5 +++-- 9 files changed, 12 insertions(+), 12 deletions(-) create mode 100644 control/proto/__init__.py rename {proto => control/proto}/gateway.proto (100%) diff --git a/.dockerignore b/.dockerignore index 07450ea7c..98bc96a24 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,7 +1,7 @@ ** # Exclude everything except: !control/*.py -!proto/*.proto +!control/proto/*.proto !pyproject.toml !pdm.lock !pdm.toml diff --git a/.env b/.env index 74edfdcec..b3186df65 100644 --- a/.env +++ b/.env @@ -1,5 +1,5 @@ # Globals -VERSION="0.0.2" +VERSION="0.0.3" CEPH_VERSION="17.2.6" SPDK_VERSION="23.01" MAINTAINER="Ceph Developers " diff --git a/Dockerfile b/Dockerfile index 25cbc43c3..39b4c3f25 100644 --- a/Dockerfile +++ b/Dockerfile @@ -85,7 +85,7 @@ LABEL io.ceph.component="$NVMEOF_NAME" \ io.ceph.git.branch="$NVMEOF_GIT_BRANCH" \ io.ceph.git.commit="$NVMEOF_GIT_COMMIT" -ENV PYTHONPATH=$APPDIR/proto:$APPDIR/__pypackages__/$PYTHON_MAJOR.$PYTHON_MINOR/lib +ENV PYTHONPATH=$APPDIR/__pypackages__/$PYTHON_MAJOR.$PYTHON_MINOR/lib WORKDIR $APPDIR @@ -120,7 +120,6 @@ RUN \ pdm "$PDM_INSTALL_CMD" $PDM_INSTALL_FLAGS COPY . . -RUN pdm run protoc #------------------------------------------------------------------------------ FROM python-intermediate diff --git a/control/cli.py b/control/cli.py index 477d37a14..9ccf2e24d 100644 --- a/control/cli.py +++ b/control/cli.py @@ -15,8 +15,8 @@ from functools import wraps -from proto import gateway_pb2_grpc as pb2_grpc -from proto import gateway_pb2 as pb2 +from .proto import gateway_pb2_grpc as pb2_grpc +from .proto import gateway_pb2 as pb2 def argument(*name_or_flags, **kwargs): diff --git a/control/grpc.py b/control/grpc.py index 36cf27489..1ea8b5ccb 100644 --- a/control/grpc.py +++ b/control/grpc.py @@ -17,8 +17,8 @@ import spdk.rpc.nvmf as rpc_nvmf from google.protobuf import json_format -from proto import gateway_pb2 as pb2 -from proto import gateway_pb2_grpc as pb2_grpc +from .proto import gateway_pb2 as pb2 +from .proto import gateway_pb2_grpc as pb2_grpc class GatewayService(pb2_grpc.GatewayServicer): diff --git a/control/proto/__init__.py b/control/proto/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/proto/gateway.proto b/control/proto/gateway.proto similarity index 100% rename from proto/gateway.proto rename to control/proto/gateway.proto diff --git a/control/server.py b/control/server.py index ab7aa8f5e..b44698900 100644 --- a/control/server.py +++ b/control/server.py @@ -25,8 +25,8 @@ import spdk.rpc.client as rpc_client import spdk.rpc.nvmf as rpc_nvmf -from proto import gateway_pb2 as pb2 -from proto import gateway_pb2_grpc as pb2_grpc +from .proto import gateway_pb2 as pb2 +from .proto import gateway_pb2_grpc as pb2_grpc from .state import GatewayState, LocalGatewayState, OmapGatewayState, GatewayStateHandler from .grpc import GatewayService diff --git a/pyproject.toml b/pyproject.toml index 0be21080c..8d081e836 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "pdm.backend" [project] name = "ceph-nvmeof" -version = "0.0.2" +version = "0.0.3" description = "Service to provide Ceph storage over NVMe-oF protocol" readme = "README.md" requires-python = "~=3.9" @@ -29,7 +29,8 @@ dependencies = [ ] [tool.pdm.scripts] -protoc = {call = "grpc_tools.command:build_package_protos('proto')"} +protoc = {call = "grpc_tools.command:build_package_protos('src.proto')"} +pre_build = {composite = ["protoc"]} [project.urls] #homepage = ""