From dbc9a4b304185e2cb0d9f425866f71161c9a1255 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 3 Aug 2022 11:27:21 +0200 Subject: 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. --- pygnulib/GLFileSystem.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'pygnulib/GLFileSystem.py') 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. -- cgit v1.2.1