From a8f6e624f1693ccdfaec60132ac1cba59c5fbc26 Mon Sep 17 00:00:00 2001 From: Innokentii Mokin Date: Wed, 24 Jan 2024 16:37:04 +0000 Subject: [PATCH] fix generate_protoc.py to support protos in draft dir --- generate_protoc.py | 2 ++ ydb/_grpc/v3/draft/ydb_dynamic_config_v1_pb2.py | 2 +- ydb/_grpc/v3/draft/ydb_dynamic_config_v1_pb2_grpc.py | 2 +- ydb/_grpc/v3/draft/ydb_maintenance_v1_pb2.py | 2 +- ydb/_grpc/v3/draft/ydb_maintenance_v1_pb2_grpc.py | 2 +- ydb/_grpc/v4/draft/ydb_dynamic_config_v1_pb2.py | 2 +- ydb/_grpc/v4/draft/ydb_dynamic_config_v1_pb2_grpc.py | 2 +- ydb/_grpc/v4/draft/ydb_maintenance_v1_pb2.py | 2 +- ydb/_grpc/v4/draft/ydb_maintenance_v1_pb2_grpc.py | 2 +- 9 files changed, 10 insertions(+), 8 deletions(-) diff --git a/generate_protoc.py b/generate_protoc.py index ab4b936a..d6926028 100644 --- a/generate_protoc.py +++ b/generate_protoc.py @@ -40,6 +40,7 @@ def remove_protos(rootdirpath: str): def fix_file_contents(rootdir, protobuf_version: str): flake_ignore_line = "# flake8: " + "noqa" # prevent ignore the file package_path = "ydb._grpc." + protobuf_version + ".protos" + draft_package_path = "ydb._grpc." + protobuf_version + ".draft.protos" for dirpath, _, fnames in os.walk(rootdir): for fname in fnames: @@ -51,6 +52,7 @@ def fix_file_contents(rootdir, protobuf_version: str): # Fix imports content = content.replace("from protos", "from " + package_path) + content = content.replace("from draft.protos", "from " + draft_package_path) # Add ignore style check content = content.replace("# -*- coding: utf-8 -*-", "# -*- coding: utf-8 -*-\n" + flake_ignore_line) diff --git a/ydb/_grpc/v3/draft/ydb_dynamic_config_v1_pb2.py b/ydb/_grpc/v3/draft/ydb_dynamic_config_v1_pb2.py index b164625f..df11607b 100644 --- a/ydb/_grpc/v3/draft/ydb_dynamic_config_v1_pb2.py +++ b/ydb/_grpc/v3/draft/ydb_dynamic_config_v1_pb2.py @@ -12,7 +12,7 @@ _sym_db = _symbol_database.Default() -from draft.protos import ydb_dynamic_config_pb2 as draft_dot_protos_dot_ydb__dynamic__config__pb2 +from ydb._grpc.v3.draft.protos import ydb_dynamic_config_pb2 as draft_dot_protos_dot_ydb__dynamic__config__pb2 DESCRIPTOR = _descriptor.FileDescriptor( diff --git a/ydb/_grpc/v3/draft/ydb_dynamic_config_v1_pb2_grpc.py b/ydb/_grpc/v3/draft/ydb_dynamic_config_v1_pb2_grpc.py index bce819d9..b22e8553 100644 --- a/ydb/_grpc/v3/draft/ydb_dynamic_config_v1_pb2_grpc.py +++ b/ydb/_grpc/v3/draft/ydb_dynamic_config_v1_pb2_grpc.py @@ -2,7 +2,7 @@ """Client and server classes corresponding to protobuf-defined services.""" import grpc -from draft.protos import ydb_dynamic_config_pb2 as draft_dot_protos_dot_ydb__dynamic__config__pb2 +from ydb._grpc.v3.draft.protos import ydb_dynamic_config_pb2 as draft_dot_protos_dot_ydb__dynamic__config__pb2 class DynamicConfigServiceStub(object): diff --git a/ydb/_grpc/v3/draft/ydb_maintenance_v1_pb2.py b/ydb/_grpc/v3/draft/ydb_maintenance_v1_pb2.py index 1c082b25..fb0b88e5 100644 --- a/ydb/_grpc/v3/draft/ydb_maintenance_v1_pb2.py +++ b/ydb/_grpc/v3/draft/ydb_maintenance_v1_pb2.py @@ -12,7 +12,7 @@ _sym_db = _symbol_database.Default() -from draft.protos import ydb_maintenance_pb2 as draft_dot_protos_dot_ydb__maintenance__pb2 +from ydb._grpc.v3.draft.protos import ydb_maintenance_pb2 as draft_dot_protos_dot_ydb__maintenance__pb2 DESCRIPTOR = _descriptor.FileDescriptor( diff --git a/ydb/_grpc/v3/draft/ydb_maintenance_v1_pb2_grpc.py b/ydb/_grpc/v3/draft/ydb_maintenance_v1_pb2_grpc.py index 65e3940f..f19400a8 100644 --- a/ydb/_grpc/v3/draft/ydb_maintenance_v1_pb2_grpc.py +++ b/ydb/_grpc/v3/draft/ydb_maintenance_v1_pb2_grpc.py @@ -2,7 +2,7 @@ """Client and server classes corresponding to protobuf-defined services.""" import grpc -from draft.protos import ydb_maintenance_pb2 as draft_dot_protos_dot_ydb__maintenance__pb2 +from ydb._grpc.v3.draft.protos import ydb_maintenance_pb2 as draft_dot_protos_dot_ydb__maintenance__pb2 class MaintenanceServiceStub(object): diff --git a/ydb/_grpc/v4/draft/ydb_dynamic_config_v1_pb2.py b/ydb/_grpc/v4/draft/ydb_dynamic_config_v1_pb2.py index aea704b9..2db646f7 100644 --- a/ydb/_grpc/v4/draft/ydb_dynamic_config_v1_pb2.py +++ b/ydb/_grpc/v4/draft/ydb_dynamic_config_v1_pb2.py @@ -12,7 +12,7 @@ _sym_db = _symbol_database.Default() -from draft.protos import ydb_dynamic_config_pb2 as draft_dot_protos_dot_ydb__dynamic__config__pb2 +from ydb._grpc.v4.draft.protos import ydb_dynamic_config_pb2 as draft_dot_protos_dot_ydb__dynamic__config__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n!draft/ydb_dynamic_config_v1.proto\x12\x14Ydb.DynamicConfig.V1\x1a%draft/protos/ydb_dynamic_config.proto2\x81\x08\n\x14\x44ynamicConfigService\x12V\n\tSetConfig\x12#.Ydb.DynamicConfig.SetConfigRequest\x1a$.Ydb.DynamicConfig.SetConfigResponse\x12\x62\n\rReplaceConfig\x12\'.Ydb.DynamicConfig.ReplaceConfigRequest\x1a(.Ydb.DynamicConfig.ReplaceConfigResponse\x12\\\n\x0bGetMetadata\x12%.Ydb.DynamicConfig.GetMetadataRequest\x1a&.Ydb.DynamicConfig.GetMetadataResponse\x12V\n\tGetConfig\x12#.Ydb.DynamicConfig.GetConfigRequest\x1a$.Ydb.DynamicConfig.GetConfigResponse\x12Y\n\nDropConfig\x12$.Ydb.DynamicConfig.DropConfigRequest\x1a%.Ydb.DynamicConfig.DropConfigResponse\x12n\n\x11\x41\x64\x64VolatileConfig\x12+.Ydb.DynamicConfig.AddVolatileConfigRequest\x1a,.Ydb.DynamicConfig.AddVolatileConfigResponse\x12w\n\x14RemoveVolatileConfig\x12..Ydb.DynamicConfig.RemoveVolatileConfigRequest\x1a/.Ydb.DynamicConfig.RemoveVolatileConfigResponse\x12\x62\n\rGetNodeLabels\x12\'.Ydb.DynamicConfig.GetNodeLabelsRequest\x1a(.Ydb.DynamicConfig.GetNodeLabelsResponse\x12\x62\n\rResolveConfig\x12\'.Ydb.DynamicConfig.ResolveConfigRequest\x1a(.Ydb.DynamicConfig.ResolveConfigResponse\x12k\n\x10ResolveAllConfig\x12*.Ydb.DynamicConfig.ResolveAllConfigRequest\x1a+.Ydb.DynamicConfig.ResolveAllConfigResponseBn\n%tech.ydb.proto.draft.dynamicconfig.v1ZBgithub.com/ydb-platform/ydb-go-genproto/draft/Ydb_DynamicConfig_V1\xf8\x01\x01\x62\x06proto3') diff --git a/ydb/_grpc/v4/draft/ydb_dynamic_config_v1_pb2_grpc.py b/ydb/_grpc/v4/draft/ydb_dynamic_config_v1_pb2_grpc.py index bce819d9..7cd2c03b 100644 --- a/ydb/_grpc/v4/draft/ydb_dynamic_config_v1_pb2_grpc.py +++ b/ydb/_grpc/v4/draft/ydb_dynamic_config_v1_pb2_grpc.py @@ -2,7 +2,7 @@ """Client and server classes corresponding to protobuf-defined services.""" import grpc -from draft.protos import ydb_dynamic_config_pb2 as draft_dot_protos_dot_ydb__dynamic__config__pb2 +from ydb._grpc.v4.draft.protos import ydb_dynamic_config_pb2 as draft_dot_protos_dot_ydb__dynamic__config__pb2 class DynamicConfigServiceStub(object): diff --git a/ydb/_grpc/v4/draft/ydb_maintenance_v1_pb2.py b/ydb/_grpc/v4/draft/ydb_maintenance_v1_pb2.py index 9486bc73..a6347ee8 100644 --- a/ydb/_grpc/v4/draft/ydb_maintenance_v1_pb2.py +++ b/ydb/_grpc/v4/draft/ydb_maintenance_v1_pb2.py @@ -12,7 +12,7 @@ _sym_db = _symbol_database.Default() -from draft.protos import ydb_maintenance_pb2 as draft_dot_protos_dot_ydb__maintenance__pb2 +from ydb._grpc.v4.draft.protos import ydb_maintenance_pb2 as draft_dot_protos_dot_ydb__maintenance__pb2 DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1e\x64raft/ydb_maintenance_v1.proto\x12\x12Ydb.Maintenance.V1\x1a\"draft/protos/ydb_maintenance.proto2\x9c\x06\n\x12MaintenanceService\x12g\n\x10ListClusterNodes\x12(.Ydb.Maintenance.ListClusterNodesRequest\x1a).Ydb.Maintenance.ListClusterNodesResponse\x12p\n\x15\x43reateMaintenanceTask\x12-.Ydb.Maintenance.CreateMaintenanceTaskRequest\x1a(.Ydb.Maintenance.MaintenanceTaskResponse\x12r\n\x16RefreshMaintenanceTask\x12..Ydb.Maintenance.RefreshMaintenanceTaskRequest\x1a(.Ydb.Maintenance.MaintenanceTaskResponse\x12m\n\x12GetMaintenanceTask\x12*.Ydb.Maintenance.GetMaintenanceTaskRequest\x1a+.Ydb.Maintenance.GetMaintenanceTaskResponse\x12s\n\x14ListMaintenanceTasks\x12,.Ydb.Maintenance.ListMaintenanceTasksRequest\x1a-.Ydb.Maintenance.ListMaintenanceTasksResponse\x12r\n\x13\x44ropMaintenanceTask\x12+.Ydb.Maintenance.DropMaintenanceTaskRequest\x1a..Ydb.Maintenance.ManageMaintenanceTaskResponse\x12_\n\x0e\x43ompleteAction\x12&.Ydb.Maintenance.CompleteActionRequest\x1a%.Ydb.Maintenance.ManageActionResponseBd\n tech.ydb.proto.draft.maintenanceZ@github.com/ydb-platform/ydb-go-genproto/draft/Ydb_Maintenance_V1b\x06proto3') diff --git a/ydb/_grpc/v4/draft/ydb_maintenance_v1_pb2_grpc.py b/ydb/_grpc/v4/draft/ydb_maintenance_v1_pb2_grpc.py index 65e3940f..e009737d 100644 --- a/ydb/_grpc/v4/draft/ydb_maintenance_v1_pb2_grpc.py +++ b/ydb/_grpc/v4/draft/ydb_maintenance_v1_pb2_grpc.py @@ -2,7 +2,7 @@ """Client and server classes corresponding to protobuf-defined services.""" import grpc -from draft.protos import ydb_maintenance_pb2 as draft_dot_protos_dot_ydb__maintenance__pb2 +from ydb._grpc.v4.draft.protos import ydb_maintenance_pb2 as draft_dot_protos_dot_ydb__maintenance__pb2 class MaintenanceServiceStub(object):