aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Dolbec <brian.dolbec@gmail.com>2011-03-08 00:05:36 -0800
committerBrian Dolbec <brian.dolbec@gmail.com>2011-03-08 00:05:36 -0800
commit37f12041c349d6cff5d5d5f4ca5934edc47b06f2 (patch)
treeddab2fa99c0b0ec41e525e002b9dd23ca7bb2ccf
parentFix small typo (diff)
downloadgentoolkit-37f12041c349d6cff5d5d5f4ca5934edc47b06f2.tar.gz
gentoolkit-37f12041c349d6cff5d5d5f4ca5934edc47b06f2.tar.bz2
gentoolkit-37f12041c349d6cff5d5d5f4ca5934edc47b06f2.zip
add a dotfile check and only delete hidden (.dotfile's) during a destructive search.
-rw-r--r--pym/gentoolkit/eclean/search.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/pym/gentoolkit/eclean/search.py b/pym/gentoolkit/eclean/search.py
index e29bbfc..4992ad7 100644
--- a/pym/gentoolkit/eclean/search.py
+++ b/pym/gentoolkit/eclean/search.py
@@ -124,7 +124,7 @@ class DistfilesSearch(object):
self.output("...checking limits for %d ebuild sources"
%len(pkgs))
- checks = self._get_default_checks(size_limit, time_limit, exclude)
+ checks = self._get_default_checks(size_limit, time_limit, exclude, destructive)
checks.extend(extra_checks)
clean_me = self._check_limits(_distdir, checks, clean_me)
# remove any protected files from the list
@@ -140,7 +140,7 @@ class DistfilesSearch(object):
####################### begin _check_limits code block
- def _get_default_checks(self, size_limit, time_limit, excludes):
+ def _get_default_checks(self, size_limit, time_limit, excludes, destructive):
#checks =[(self._isreg_check_, "is_reg_check")]
checks =[self._isreg_check_]
if 'filenames' in excludes:
@@ -159,6 +159,10 @@ class DistfilesSearch(object):
checks.append(partial(self._time_check_, time_limit))
else:
self.output(" - skipping time limit check")
+ if destructive:
+ self.output(" - skipping dot files check")
+ else:
+ checks.append(self._dotfile_check_)
return checks
@@ -234,6 +238,14 @@ class DistfilesSearch(object):
return True, False
return False, True
+ @staticmethod
+ def _dotfile_check_(file_stat, file):
+ """check if file is a regular file."""
+ head, tail = os.path.split(file)
+ if tail:
+ is_dot_file = tail.startswith('.')
+ return is_dot_file, not is_dot_file
+
####################### end _check_limits code block
@staticmethod