From: Zac Medico Date: Thu, 2 Aug 2007 17:20:01 +0000 (-0000) Subject: For bug #187518, handle EISDIR thrown from mkdir when the directory already exists... X-Git-Tag: v2.1.2.12~17 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4f95d49891fd694c9828d49724b6ac69c4407a8b;p=portage.git For bug #187518, handle EISDIR thrown from mkdir when the directory already exists on FreeBSD. (branches/2.1.2 r7545) svn path=/main/branches/2.1.2.9/; revision=7546 --- diff --git a/pym/portage_util.py b/pym/portage_util.py index d71add57e..5784ff88a 100644 --- a/pym/portage_util.py +++ b/pym/portage_util.py @@ -76,7 +76,7 @@ def map_dictlist_vals(func,myDict): """Performs a function on each value of each key in a dictlist. Returns a new dictlist.""" new_dl = {} - for key in myDict: + for key in myDict.keys(): new_dl[key] = [] new_dl[key] = map(func,myDict[key]) return new_dl @@ -118,7 +118,7 @@ def stack_dictlist(original_dicts, incremental=0, incrementals=[], ignore_none=0 for mydict in original_dicts: if mydict is None: continue - for y in mydict: + for y in mydict.keys(): if not y in final_dict: final_dict[y] = [] @@ -280,7 +280,7 @@ def writedict(mydict,myfilename,writekey=True): for x in mydict.values(): myfile.write(x+"\n") else: - for x in mydict: + for x in mydict.keys(): myfile.write("%s %s\n" % (x, " ".join(mydict[x]))) myfile.close() except IOError: @@ -852,7 +852,7 @@ def ensure_dirs(dir_path, *args, **kwargs): created_dir = True except OSError, oe: func_call = "makedirs('%s')" % dir_path - if errno.EEXIST == oe.errno: + if oe.errno in (errno.EEXIST, errno.EISDIR): pass elif oe.errno == errno.EPERM: raise OperationNotPermitted(func_call)