From 951085a47c466330055e6451c40d281e57f940cc Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Jul 10 2020 07:50:10 +0000 Subject: Workaround issue with 'exist_ok' not existing on Python 2 --- diff --git a/cccc/git.py b/cccc/git.py index 443bc8f..f29ee0a 100644 --- a/cccc/git.py +++ b/cccc/git.py @@ -51,7 +51,8 @@ def clone_repo(repodir, url, branch="master", commit=None, id_file=None, :return: None """ # create destination directory if it does not exist - os.makedirs(repodir, exist_ok=True) + if not os.path.exists(repodir): + os.makedirs(repodir, exist_ok=True) # make sure destination directory is empty if os.listdir(repodir): raise RuntimeError("Directory %s is not empty" % repodir) @@ -189,7 +190,8 @@ def import_contents(dest, src): :return: None """ # make sure destination directory exists - os.makedirs(dest, exist_ok=True) + if not os.path.exists(dest): + os.makedirs(dest, exist_ok=True) # src needs to have a single trailing "/" for rsync cmd = ["rsync", "-av", "--exclude=.git*", "--delete", src + "/", dest] execute_cmd(cmd)