From: Zac Medico Date: Mon, 23 Aug 2010 07:23:15 +0000 (-0700) Subject: Make recursive grablines() ignore the same directories as X-Git-Tag: v2.2_rc69~27 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d352f409a7178f36c77cf5c47b7783f22a00486a;p=portage.git Make recursive grablines() ignore the same directories as portage.listdir(), and do the same for update_config_files(). --- diff --git a/pym/portage/update.py b/pym/portage/update.py index cbb154041..62dbf93f0 100644 --- a/pym/portage/update.py +++ b/pym/portage/update.py @@ -1,4 +1,4 @@ -# Copyright 1999-2009 Gentoo Foundation +# Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 import codecs @@ -17,6 +17,7 @@ portage.proxy.lazyimport.lazyimport(globals(), 'remove_slot', 'portage.util:ConfigProtect,grabfile,new_protect_filename,' + \ 'normalize_path,write_atomic,writemsg', + 'portage.util.listdir:_ignorecvs_dirs', 'portage.versions:ververify' ) @@ -227,7 +228,7 @@ def update_config_files(config_root, protect, protect_mask, update_iter, match_c except UnicodeDecodeError: dirs.remove(y_enc) continue - if y.startswith("."): + if y.startswith(".") or y in _ignorecvs_dirs: dirs.remove(y_enc) for y in files: try: diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py index b5ae524b0..279a12137 100644 --- a/pym/portage/util/__init__.py +++ b/pym/portage/util/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2004-2009 Gentoo Foundation +# Copyright 2004-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 __all__ = ['apply_permissions', 'apply_recursive_permissions', @@ -23,6 +23,9 @@ import sys import traceback import portage +portage.proxy.lazyimport.lazyimport(globals(), + 'portage.util.listdir:_ignorecvs_dirs' +) from portage import StringIO from portage import os from portage import pickle @@ -328,7 +331,7 @@ def grabfile_package(myfilename, compatlevel=0, recursive=0, allow_wildcard=Fals def grablines(myfilename,recursive=0): mylines=[] if recursive and os.path.isdir(myfilename): - if os.path.basename(myfilename) in ["RCS", "CVS", "SCCS"]: + if os.path.basename(myfilename) in _ignorecvs_dirs: return mylines dirlist = os.listdir(myfilename) dirlist.sort() diff --git a/pym/portage/util/listdir.py b/pym/portage/util/listdir.py index ab7ffddf5..f73c97025 100644 --- a/pym/portage/util/listdir.py +++ b/pym/portage/util/listdir.py @@ -11,6 +11,7 @@ from portage import os from portage.exception import DirectoryNotFound, PermissionDenied, PortageException from portage.util import normalize_path, writemsg +_ignorecvs_dirs = ('CVS', 'RCS', 'SCCS', '.svn', '.git') dircache = {} cacheHit = 0 cacheMiss = 0 @@ -85,8 +86,6 @@ 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): """