bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Collin Funk <collin.funk1@gmail.com>
To: bug-gnulib@gnu.org
Subject: gnulib-tool.py: Fix extra arguments to function call.
Date: Sat, 13 Apr 2024 10:12:45 -0700	[thread overview]
Message-ID: <af03edbd-8231-4c26-a0b1-ef6ebdb30dbe@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 916 bytes --]

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

[-- Attachment #2: 0001-gnulib-tool.py-Fix-extra-arguments-to-function-call.patch --]
[-- Type: text/x-patch, Size: 1563 bytes --]

From f0990590b62f0a5e18970643ac31c967b4a5f19d Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.funk1@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.funk1@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  <bruno@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	other threads:[~2024-04-13 17:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-13 17:12 Collin Funk [this message]
2024-04-13 17:26 ` gnulib-tool.py: Fix extra arguments to function call Collin Funk
2024-04-13 18:08   ` .gitattributes Bruno Haible
2024-04-13 18:18     ` Improve 'git diff' of Python files Collin Funk
2024-04-13 18:29       ` Bruno Haible
2024-04-13 18:03 ` gnulib-tool.py: Fix extra arguments to function call Bruno Haible

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=af03edbd-8231-4c26-a0b1-ef6ebdb30dbe@gmail.com \
    --to=collin.funk1@gmail.com \
    --cc=bug-gnulib@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).