From: Zack Cerza Date: Wed, 6 Aug 2014 22:23:19 +0000 (-0600) Subject: After resetting a repo, remove all pyc files X-Git-Tag: 1.1.0~1283 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7912fd5742061bd9eb6ba6f6a21644d0358595e6;p=teuthology.git After resetting a repo, remove all pyc files Signed-off-by: Zack Cerza --- diff --git a/teuthology/repo_utils.py b/teuthology/repo_utils.py index 47346083e..27ae3fccd 100644 --- a/teuthology/repo_utils.py +++ b/teuthology/repo_utils.py @@ -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)