diff options
author | Jack Lloyd <[email protected]> | 2017-12-11 23:49:03 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-12-11 23:49:03 -0500 |
commit | 5594497449d5572e0459aed741db87e5255ef5ea (patch) | |
tree | 7af67f025ef6557f99872196c04e0b8d0772a228 /src/scripts/cleanup.py | |
parent | fd05ab57f2c13e0ba2ac371d3fa81b4ecdcecfc7 (diff) |
Fix make clean
Diffstat (limited to 'src/scripts/cleanup.py')
-rwxr-xr-x | src/scripts/cleanup.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/scripts/cleanup.py b/src/scripts/cleanup.py index d2aaf4303..39a505852 100755 --- a/src/scripts/cleanup.py +++ b/src/scripts/cleanup.py @@ -10,6 +10,7 @@ Botan is released under the Simplified BSD License (see license.txt) import os import sys +import stat import re import optparse # pylint: disable=deprecated-module import logging @@ -41,7 +42,13 @@ def remove_all_in_dir(d): logging.debug('Removing all files in directory "%s"', d) for f in os.listdir(d): - remove_file(os.path.join(d, f)) + full_path = os.path.join(d, f) + mode = os.lstat(full_path).st_mode + + if stat.S_ISDIR(mode): + remove_dir(full_path) + else: + remove_file(full_path) def parse_options(args): parser = optparse.OptionParser() |