File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -183,6 +183,25 @@ def gen_grpc():
183183 # Needed to support absolute imports in files. See
184184 # https://github.com/protocolbuffers/protobuf/issues/1491
185185 make_absolute_imports (compiled_files )
186+ copy_tree_merge (str (built_protos_dir ), str (proto_root_dir ))
187+
188+ def copy_tree_merge (src , dst ):
189+ """
190+ Recursively copy all files and subdirectories from src to dst,
191+ overwriting files if they already exist. This emulates what
192+ distutils.dir_util.copy_tree did without removing existing directories.
193+ """
194+ if not os .path .exists (dst ):
195+ os .makedirs (dst )
196+
197+ for item in os .listdir (src ):
198+ s = os .path .join (src , item )
199+ d = os .path .join (dst , item )
200+
201+ if os .path .isdir (s ):
202+ copy_tree_merge (s , d )
203+ else :
204+ shutil .copy2 (s , d )
186205
187206def make_absolute_imports (compiled_files ):
188207 for compiled in compiled_files :
You can’t perform that action at this time.
0 commit comments