Skip to content

Commit

Permalink
shutil.copytree を自作
Browse files Browse the repository at this point in the history
  • Loading branch information
enm10k committed Jan 19, 2024
1 parent dc71f0b commit d9301fe
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,17 @@ def apply_patch(patch, dir, depth):
with open(patch) as stdin:
cmd(['patch', f'-p{depth}'], stdin=stdin)

# shutil.copytree の dirs_exist_ok=True を使いたかったが、 Python 3.8 からでなくと利用できなかった
# actions/setup-python で Python 3.8 を利用したところ、 Lyra のビルドに影響が出たためこの関数を自作した
def copytree(src_dir, dst_dir):
for file_path in glob.glob(src_dir + '/**', recursive=True):
dest_path = os.path.join(dst_dir, os.path.relpath(file_path, src_dir))

if os.path.isdir(file_path):
os.makedirs(dest_path, exist_ok=True)
else:
shutil.copy2(file_path, dest_path)


@versioned
def install_webrtc(version, source_dir, install_dir, platform: str):
Expand Down Expand Up @@ -709,8 +720,8 @@ def install_cuda_windows(version, source_dir, build_dir, install_dir):
mkdir_p(os.path.join(install_dir, 'cuda'))
with cd(os.path.join(build_dir, 'cuda')):
cmd(['7z', 'x', file])
shutil.copytree(os.path.join(build_dir, 'cuda', 'cuda_nvcc', 'nvcc'), os.path.join(install_dir, 'cuda'), dirs_exist_ok=True)
shutil.copytree(os.path.join(build_dir, 'cuda', 'cuda_cudart', 'cudart'), os.path.join(install_dir, 'cuda'), dirs_exist_ok=True)
copytree(os.path.join(build_dir, 'cuda', 'cuda_nvcc', 'nvcc'), os.path.join(install_dir, 'cuda'))
copytree(os.path.join(build_dir, 'cuda', 'cuda_cudart', 'cudart'), os.path.join(install_dir, 'cuda'))


@versioned
Expand Down

0 comments on commit d9301fe

Please sign in to comment.