internal os.path.join calls to raise UnicodeDecodeError.
svn path=/main/trunk/; revision=13926
""" epatch will just grab all the patches out of a directory, so we have to
make sure there aren't any foreign files that it might grab."""
filesdir = os.path.join(pkgdir, "files")
+ if isinstance(filesdir, unicode):
+ # Avoid UnicodeDecodeError raised from
+ # os.path.join when called by os.walk.
+ filesdir = filesdir.encode('utf_8', 'replace')
+
for parent, dirs, files in os.walk(filesdir):
for d in dirs:
if d.startswith(".") or d == "CVS":
os.system("chflags -R nosunlnk,nouunlnk %s 2>/dev/null" % \
(_shell_quote(mysettings["D"]),))
+ destdir = mysettings["D"]
+ if isinstance(destdir, unicode):
+ # Avoid UnicodeDecodeError raised from
+ # os.path.join when called by os.walk.
+ destdir = destdir.encode('utf_8', 'replace')
+
for parent, dirs, files in os.walk(mysettings["D"]):
for fname in chain(dirs, files):
fpath = os.path.join(parent, fname)
return os.path.exists(self.__get_path(cpv))
def __iter__(self):
- for root,dirs,files in os.walk(self.portdir):
+
+ portdir = self.portdir
+ if isinstance(portdir, unicode):
+ # Avoid UnicodeDecodeError raised from
+ # os.path.join when called by os.walk.
+ portdir = portdir.encode('utf_8', 'replace')
+
+ for root, dirs, files in os.walk(portdir):
for file in files:
if file[-7:] == '.ebuild':
cat = os.path.basename(os.path.dirname(root))
myfilelist = []
mylinklist = []
paths_with_newlines = []
+
+ if isinstance(srcroot, unicode):
+ # Avoid UnicodeDecodeError raised from
+ # os.path.join when called by os.walk.
+ srcroot = srcroot.encode('utf_8', 'replace')
+
srcroot_len = len(srcroot)
def onerror(e):
raise
@rtype: list
@returns: List of files to process
"""
+
+ if isinstance(filename, unicode):
+ # Avoid UnicodeDecodeError raised from
+ # os.path.join when called by os.walk.
+ filename = filename.encode('utf_8', 'replace')
+
try:
st = os.stat(filename)
except OSError:
cpvlist = []
pn = os.path.basename(self.pkgdir.rstrip(os.path.sep))
cat = self._pkgdir_category()
- for pkgdir, pkgdir_dirs, pkgdir_files in os.walk(self.pkgdir):
+
+ pkgdir = self.pkgdir
+ if isinstance(pkgdir, unicode):
+ # Avoid UnicodeDecodeError raised from
+ # os.path.join when called by os.walk.
+ pkgdir = pkgdir.encode('utf_8', 'replace')
+
+ for pkgdir, pkgdir_dirs, pkgdir_files in os.walk(pkgdir):
break
for f in pkgdir_files:
if f[:1] == ".":
continue
self.fhashdict[mytype][f] = perform_multiple_checksums(self.pkgdir+f, self.hashes)
recursive_files = []
- cut_len = len(os.path.join(self.pkgdir, "files") + os.sep)
- for parentdir, dirs, files in os.walk(os.path.join(self.pkgdir, "files")):
+
+ pkgdir = self.pkgdir
+ if isinstance(pkgdir, unicode):
+ # Avoid UnicodeDecodeError raised from
+ # os.path.join when called by os.walk.
+ pkgdir = pkgdir.encode('utf_8', 'replace')
+
+ cut_len = len(os.path.join(pkgdir, "files") + os.sep)
+ for parentdir, dirs, files in os.walk(os.path.join(pkgdir, "files")):
for f in files:
full_path = os.path.join(parentdir, f)
recursive_files.append(full_path[cut_len:])
directory = self._repopath_sub.sub(trees["porttree"].dbapi.treemap[match.groupdict()["reponame"]], directory)
except KeyError:
raise SetConfigError(_("Could not find repository '%s'") % match.groupdict()["reponame"])
+
+ if isinstance(directory, unicode):
+ # Avoid UnicodeDecodeError raised from
+ # os.path.join when called by os.walk.
+ directory_unicode = directory
+ directory = directory.encode('utf_8', 'replace')
+ else:
+ directory_unicode = unicode(directory,
+ encoding='utf_8', errors='replace')
+
if os.path.isdir(directory):
directory = normalize_path(directory)
for parent, dirs, files in os.walk(directory):
+ if not isinstance(parent, unicode):
+ parent = unicode(parent,
+ encoding='utf_8', errors='replace')
for d in dirs[:]:
if d[:1] == '.':
dirs.remove(d)
if filename.endswith(".metadata"):
continue
filename = os.path.join(parent,
- filename)[1 + len(directory):]
+ filename)[1 + len(directory_unicode):]
myname = name_pattern.replace("$name", filename)
myname = myname.replace("${name}", filename)
rValue[myname] = StaticFileSet(
protect - list of paths from CONFIG_PROTECT
protect_mask - list of paths from CONFIG_PROTECT_MASK
update_iter - list of update commands as returned from parse_updates()"""
+
+ if isinstance(config_root, unicode):
+ # Avoid UnicodeDecodeError raised from
+ # os.path.join when called by os.walk.
+ config_root = config_root.encode('utf_8', 'replace')
+
config_root = normalize_path(config_root)
update_files = {}
file_contents = {}
Returns True if all permissions are applied and False if some are left
unapplied."""
+ if isinstance(top, unicode):
+ # Avoid UnicodeDecodeError raised from
+ # os.path.join when called by os.walk.
+ top = top.encode('utf_8', 'replace')
+
if onerror is None:
# Default behavior is to dump errors to stderr so they won't
# go unnoticed. Callers can pass in a quiet instance.