summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-01-22 00:51:19 +0000
committerZac Medico <zmedico@gentoo.org>2009-01-22 00:51:19 +0000
commita451482790e266041fad933b652f28fe7abf1592 (patch)
tree9e0e7ba5fda612d0be0b335031b0c335548eefba
parentd99c1bd02d4cf6e9970a65b6f1947d4d6a9e3d91 (diff)
downloadportage-a451482790e266041fad933b652f28fe7abf1592.tar.gz
portage-a451482790e266041fad933b652f28fe7abf1592.tar.bz2
portage-a451482790e266041fad933b652f28fe7abf1592.zip
Make listdir(ignorecvs=True) ignore .git directories. Thanks to Christian
Ruppert for the suggestion. svn path=/main/trunk/; revision=12545
-rw-r--r--pym/portage/__init__.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 77254bad4..a3acb91d1 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -265,6 +265,8 @@ def cacheddir(my_original_path, ignorecvs, ignorelist, EmptyOnError, followSymli
writemsg("cacheddirStats: H:%d/M:%d/S:%d\n" % (cacheHit, cacheMiss, cacheStale),10)
return ret_list, ret_ftype
+_ignorecvs_dirs = ('CVS', 'SCCS', '.svn', '.git')
+
def listdir(mypath, recursive=False, filesonly=False, ignorecvs=False, ignorelist=[], followSymlinks=True,
EmptyOnError=False, dirsonly=False):
"""
@@ -276,7 +278,7 @@ def listdir(mypath, recursive=False, filesonly=False, ignorecvs=False, ignorelis
@type recursive: Boolean
@param filesonly; Only return files, not more directories
@type filesonly: Boolean
- @param ignorecvs: Ignore CVS directories ('CVS','.svn','SCCS')
+ @param ignorecvs: Ignore CVS directories ('CVS','SCCS','.svn','.git')
@type ignorecvs: Boolean
@param ignorelist: List of filenames/directories to exclude
@type ignorelist: List
@@ -303,7 +305,8 @@ def listdir(mypath, recursive=False, filesonly=False, ignorecvs=False, ignorelis
if recursive:
x=0
while x<len(ftype):
- if ftype[x]==1 and not (ignorecvs and os.path.basename(list[x]) in ('CVS','.svn','SCCS')):
+ if ftype[x] == 1 and not \
+ (ignorecvs and os.path.basename(list[x]) in _ignorecvs_dirs):
l,f = cacheddir(mypath+"/"+list[x], ignorecvs, ignorelist, EmptyOnError,
followSymlinks)