diff options
author | Johan Dahlin <johan@gnome.org> | 2010-09-01 20:54:16 -0300 |
---|---|---|
committer | Johan Dahlin <johan@gnome.org> | 2010-09-01 20:55:14 -0300 |
commit | dfff733b154abf1e85d447d2da389b34396fe005 (patch) | |
tree | 7f4bbbac3c1266abb8a6b01bfb398681e80259b6 /giscanner/scannermain.py | |
parent | 2399da3d6030818b3bf9882bd37bbadacc72834d (diff) | |
download | gobject-introspection-dfff733b154abf1e85d447d2da389b34396fe005.tar.gz |
[scannermain] Use shutil.move instead of os.rename
In case that the temporary directory and the output directory
is not on the same filesystem.
Diffstat (limited to 'giscanner/scannermain.py')
-rw-r--r-- | giscanner/scannermain.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py index 2d3ced4b..8db1d2bf 100644 --- a/giscanner/scannermain.py +++ b/giscanner/scannermain.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- Mode: Python -*- # GObject-Introspection - a framework for introspecting GObject libraries -# Copyright (C) 2008 Johan Dahlin +# Copyright (C) 2008-2010 Johan Dahlin # Copyright (C) 2009 Red Hat, Inc. # # This program is free software; you can redistribute it and/or @@ -20,8 +20,10 @@ # 02110-1301, USA. # +import errno import optparse import os +import shutil import subprocess import sys import tempfile @@ -371,7 +373,13 @@ def scanner_main(args): raise SystemExit( "Failed to re-parse .gir file; scanned=%r passthrough=%r" % (main_f.name, temp_f.name)) os.unlink(temp_f.name) - os.rename(main_f.name, options.output) + try: + shutil.move(main_f.name, options.output) + except OSError, e: + if e.errno == errno.EPERM: + os.unlink(main_f.name) + return + raise else: sys.stdout.write(data) |