Commits

Michał Górny  committed f6e52c2

Use shutil.move() instead of os.rename().

  • Participants
  • Parent commits 8ef3eb6

Comments (0)

Files changed (1)

File lib/flaggie/packagefile.py

 # (C) 2010 Michał Górny <gentoo@mgorny.alt.pl>
 # Released under the terms of the 3-clause BSD license.
 
-import codecs, os, os.path, tempfile
+import codecs, os, os.path, shutil, tempfile
 
 class PackageFileSet(object):
 	class PackageFile(list):
 			f.close()
 
 			backup = self.path + '~'
-			try:
-				os.rename(self.path, backup)
-			except OSError: # Windows?
-				os.remove(backup)
-				os.rename(self.path, backup)
-			os.rename(tmpname, self.path)
+			shutil.move(self.path, backup)
+			shutil.move(tmpname, self.path)
 
 			for e in self:
 				e.modified = False