From 0c2f641f7f9e67b9a86e5e8688bb0fb7aa3beda3 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 12 Feb 2006 21:09:49 +0000 Subject: use write_atomic for fixdbentries svn path=/main/trunk/; revision=2698 --- pym/portage.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'pym') diff --git a/pym/portage.py b/pym/portage.py index 4c574b3f0..2b9868aca 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -3654,7 +3654,8 @@ def fixdbentries(old_value, new_value, dbdir): """python replacement for the fixdbentries script, replaces old_value with new_value for package names in files in dbdir.""" for myfile in [f for f in os.listdir(dbdir) if not f == "CONTENTS"]: - f = open(dbdir+"/"+myfile, "r") + file_path = os.path.join(dbdir, myfile) + f = open(file_path, "r") mycontent = f.read() f.close() if not mycontent.count(old_value): @@ -3664,9 +3665,7 @@ def fixdbentries(old_value, new_value, dbdir): mycontent = re.sub(old_value+"(\\s)", new_value+"\\1", mycontent) mycontent = re.sub(old_value+"(-[^a-zA-Z])", new_value+"\\1", mycontent) mycontent = re.sub(old_value+"([^a-zA-Z0-9-])", new_value+"\\1", mycontent) - f = open(dbdir+"/"+myfile, "w") - f.write(mycontent) - f.close() + write_atomic(file_path, mycontent) class packagetree: def __init__(self,virtual,clone=None): -- cgit v1.2.3-1-g7c22