diff options
author | Bruno Haible <bruno@clisp.org> | 2022-08-03 11:27:21 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2022-08-03 11:27:21 +0200 |
commit | dbc9a4b304185e2cb0d9f425866f71161c9a1255 (patch) | |
tree | 3ea1526794114be5ee54c00ed8305f18fc969e6f /pygnulib/GLFileSystem.py | |
parent | f88aeeb42a4926bc2f7bcb7758ca511e75404593 (diff) | |
download | gnulib-dbc9a4b304185e2cb0d9f425866f71161c9a1255.tar.gz |
gnulib-tool.py: Avoid errors when writing to a VFAT file system.
* pygnulib/constants.py (copyfile, copyfile2): New functions.
* gnulib-tool.py: Use them instead of shutil.
* pygnulib/*.py: Likewise.
Diffstat (limited to 'pygnulib/GLFileSystem.py')
-rw-r--r-- | pygnulib/GLFileSystem.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/pygnulib/GLFileSystem.py b/pygnulib/GLFileSystem.py index dfb1bb903f..5368f3c1b8 100644 --- a/pygnulib/GLFileSystem.py +++ b/pygnulib/GLFileSystem.py @@ -42,6 +42,7 @@ __copyright__ = constants.__copyright__ #=============================================================================== DIRS = constants.DIRS joinpath = constants.joinpath +copyfile = constants.copyfile isdir = os.path.isdir isfile = os.path.isfile @@ -118,7 +119,7 @@ class GLFileSystem(object): pass # Skip errors if directory exists if isfile(tempFile): os.remove(tempFile) - shutil.copy(lookedupFile, tempFile) + copyfile(lookedupFile, tempFile) for diff_in_localdir in reversed(lookedupPatches): command = 'patch -s "%s" < "%s" >&2' % (tempFile, diff_in_localdir) try: # Try to apply patch @@ -317,7 +318,7 @@ class GLFileAssistant(object): try: # Try to move file if os.path.exists(basepath): os.remove(basepath) - shutil.copy(tmpfile, rewritten) + copyfile(tmpfile, rewritten) except Exception as error: raise GLError(17, original) else: # if self.config['dryrun'] @@ -352,7 +353,7 @@ class GLFileAssistant(object): sed_transform_testsrelated_lib_file = self.transformers.get( 'tests', '') try: # Try to copy lookedup file to tmpfile - shutil.copy(lookedup, tmpfile) + copyfile(lookedup, tmpfile) except Exception as error: raise GLError(15, lookedup) # Don't process binary files with sed. |