Skip to content

Commit 6083d7f

Browse files
committed
Updated test setup to add grpc dir copy
1 parent c465406 commit 6083d7f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/test_setup.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff 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

187206
def make_absolute_imports(compiled_files):
188207
for compiled in compiled_files:

0 commit comments

Comments
 (0)