I see a warning for this section of code because isfile() is called
with two arguments. It looks like the correct way to write this is to
joinpath() the two arguments, since that is what is done in
self.assistant.super_update() when not self.config['dryrun'].

diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py
index d44ceedcec..098bbc59ac 100644
--- a/pygnulib/GLImport.py
+++ b/pygnulib/GLImport.py
@@ -1230,7 +1230,7 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
                     os.remove(tmpfile)
             else:  # if not self.config['dryrun']
                 backupname = '%s~' % basename
-                if isfile(destdir, basename):
+                if isfile(joinpath(destdir, basename)):
                     print('Update %s (backup in %s)' % (basename, backupname))
                 else:  # if not isfile(destdir, basename)
                     print('Create %s' % basename)

Collin
From f0990590b62f0a5e18970643ac31c967b4a5f19d Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Sat, 13 Apr 2024 10:09:17 -0700
Subject: [PATCH] gnulib-tool.py: Fix extra arguments to function call.

* pygnulib/GLImport.py (GLImport.execute): Add the missing joinpath call
on two file name components before calling isfile().
---
 ChangeLog            | 6 ++++++
 pygnulib/GLImport.py | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index c72165e268..d65595122c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-04-13  Collin Funk  <collin.fu...@gmail.com>
+
+	gnulib-tool.py: Fix extra arguments to function call.
+	* pygnulib/GLImport.py (GLImport.execute): Add the missing joinpath call
+	on two file name components before calling isfile().
+
 2024-04-13  Bruno Haible  <br...@clisp.org>
 
 	gnulib-tool.py: Code tweak.
diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py
index d44ceedcec..098bbc59ac 100644
--- a/pygnulib/GLImport.py
+++ b/pygnulib/GLImport.py
@@ -1230,7 +1230,7 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
                     os.remove(tmpfile)
             else:  # if not self.config['dryrun']
                 backupname = '%s~' % basename
-                if isfile(destdir, basename):
+                if isfile(joinpath(destdir, basename)):
                     print('Update %s (backup in %s)' % (basename, backupname))
                 else:  # if not isfile(destdir, basename)
                     print('Create %s' % basename)
-- 
2.44.0

Reply via email to