--- a/misc/update-glib-annotations.py
+++ b/misc/update-glib-annotations.py
@@ -57,7 +57,7 @@
         extract_annotations(module_name, glib_src_dir, target)
     if os.path.isfile(target_path):
         os.unlink(target_path)
-    os.rename(tmpname, target_path)
+    shutil.move(tmpname, target_path)
 
     print("Updated '%s'" % (target_path, ))