From e2b564024b5482feb6dfdc29172205ed3d7526dd Mon Sep 17 00:00:00 2001 From: david-sarah Date: Fri, 14 Jan 2011 21:30:11 -0800 Subject: [PATCH] misc/build_helpers/test-with-fake-dists.py: clean up directories and files only if they exist. --- misc/build_helpers/test-with-fake-dists.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/misc/build_helpers/test-with-fake-dists.py b/misc/build_helpers/test-with-fake-dists.py index 3b3f62a9..7814a57a 100644 --- a/misc/build_helpers/test-with-fake-dists.py +++ b/misc/build_helpers/test-with-fake-dists.py @@ -60,11 +60,20 @@ def test(): cleanup() def cleanup(): - shutil.rmtree('build') - shutil.rmtree('support') - shutil.rmtree(os.path.join('src', 'allmydata_tahoe.egg-info')) - os.remove(os.path.join('bin', 'tahoe')) - os.remove(os.path.join('bin', 'tahoe.pyscript')) + egg_info = os.path.join('src', 'allmydata_tahoe.egg-info') + bin_tahoe = os.path.join('bin', 'tahoe') + bin_tahoe_pyscript = os.path.join('bin', 'tahoe.pyscript') + + if os.path.exists('build'): + shutil.rmtree('build') + if os.path.exists('support'): + shutil.rmtree('support') + if os.path.exists(egg_info): + shutil.rmtree(egg_info) + if os.path.exists(bin_tahoe): + os.remove(bin_tahoe) + if os.path.exists(bin_tahoe_pyscript): + os.remove(bin_tahoe_pyscript) if __name__ == '__main__': test() -- 2.45.2