]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
After resetting a repo, remove all pyc files
authorZack Cerza <zack.cerza@inktank.com>
Wed, 6 Aug 2014 22:23:19 +0000 (16:23 -0600)
committerZack Cerza <zack.cerza@inktank.com>
Thu, 7 Aug 2014 17:13:42 +0000 (11:13 -0600)
Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
teuthology/repo_utils.py

index 47346083e20c396828e72c9f0b2ba96c6c80b645..27ae3fccdfda024257d15b057124c5477e03c536 100644 (file)
@@ -37,6 +37,7 @@ def enforce_repo_state(repo_url, dest_path, branch, remove_on_error=True):
             log.info("%s was just updated; assuming it is current", branch)
 
         reset_repo(repo_url, dest_path, branch)
+        remove_pyc_files(dest_path)
     except BranchNotFoundError:
         if remove_on_error:
             shutil.rmtree(dest_path, ignore_errors=True)
@@ -137,6 +138,12 @@ def reset_repo(repo_url, dest_path, branch):
         raise BranchNotFoundError(branch, repo_url)
 
 
+def remove_pyc_files(dest_path):
+    subprocess.check_call(
+        ['find', dest_path, '-name', '*.pyc', '-exec', 'rm', '{}', ';']
+    )
+
+
 def validate_branch(branch):
     if ' ' in branch:
         raise ValueError("Illegal branch name: '%s'" % branch)