[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] gnulib-tool.py: Don't try to remove files that don't exist.
|
From: |
Collin Funk |
|
Subject: |
[PATCH] gnulib-tool.py: Don't try to remove files that don't exist. |
|
Date: |
Sat, 16 Mar 2024 21:00:01 -0700 |
|
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Yesterday one of my patches included a tiny bug. In the Emacs source
directory:
$ env GNULIB_TOOL_IMPL=py ./admin/merge-gnulib
Copying file lib/gl_openssl.h
Traceback (most recent call last):
File "/home/collin/.local/src/emacs/../gnulib/pygnulib/main.py", line 1298,
in <module>
main()
File "/home/collin/.local/src/emacs/../gnulib/pygnulib/main.py", line 881, in
main
importer.execute(filetable, transformers)
File "/home/collin/.local/src/gnulib/pygnulib/GLImport.py", line 1130, in
execute
self.assistant.add_or_update(already_present)
File "/home/collin/.local/src/gnulib/pygnulib/GLFileSystem.py", line 398, in
add_or_update
os.remove(tmpfile)
FileNotFoundError: [Errno 2] No such file or directory: 'lib/gl_openssl.h.tmp'
It seems that this only occurs in packages with gnulib sources contained
in them. When the files are the same as what is currently in gnulib the
temporary file is not created. This should fix the issue:
diff --git a/pygnulib/GLFileSystem.py b/pygnulib/GLFileSystem.py
index 7c6c9a15ef..c199235e2e 100644
--- a/pygnulib/GLFileSystem.py
+++ b/pygnulib/GLFileSystem.py
@@ -395,7 +395,8 @@ class GLFileAssistant(object):
# frequently that developers don't put autogenerated files under
version control.
self.add(lookedup, tmpflag, tmpfile)
self.addFile(rewritten)
- os.remove(tmpfile)
+ if isfile(tmpfile):
+ os.remove(tmpfile)
The corresponding lines in gnulib-tool.sh use 'rm -f "$tmpfile"' to
silence warnings when files do not exist.
Collin
0003-gnulib-tool.py-Don-t-try-to-remove-files-that-don-t-.patch
Description: Text Data