diff options
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/update_deps.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/scripts/update_deps.py b/scripts/update_deps.py index ea21c9fb..ffd928f6 100755 --- a/scripts/update_deps.py +++ b/scripts/update_deps.py @@ -242,7 +242,6 @@ from __future__ import print_function import argparse import json -import distutils.dir_util import os.path import subprocess import sys @@ -275,6 +274,12 @@ def on_rm_error( func, path, exc_info): os.chmod( path, stat.S_IWRITE ) os.unlink( path ) +def make_or_exist_dirs(path): + "Wrapper for os.makedirs that tolerates the directory already existing" + # Could use os.makedirs(path, exist_ok=True) if we drop python2 + if not os.path.isdir(path): + os.makedirs(path) + def command_output(cmd, directory, fail_ok=False): """Runs a command in a directory and returns its standard output stream. @@ -346,7 +351,7 @@ class GoodRepo(object): def Clone(self, retries=10, retry_seconds=60): print('Cloning {n} into {d}'.format(n=self.name, d=self.repo_dir)) for retry in range(retries): - distutils.dir_util.mkpath(self.repo_dir) + make_or_exist_dirs(self.repo_dir) try: command_output(['git', 'clone', self.url, '.'], self.repo_dir) # If we get here, we didn't raise an error @@ -426,7 +431,7 @@ class GoodRepo(object): shutil.rmtree(self.install_dir) # Create and change to build directory - distutils.dir_util.mkpath(self.build_dir) + make_or_exist_dirs(self.build_dir) os.chdir(self.build_dir) cmake_cmd = [ @@ -665,7 +670,7 @@ def main(): save_cwd = os.getcwd() # Create working "top" directory if needed - distutils.dir_util.mkpath(args.dir) + make_or_exist_dirs(args.dir) abs_top_dir = os.path.abspath(args.dir) repos = GetGoodRepos(args) |
