From e6f143f01dd7f1629f56f4073ff28fe317118f54 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 6 Aug 2022 23:22:26 +0200 Subject: [PATCH] gnulib-tool: In the VC files messages, omit the destination directory. This makes these messages consistent with the other "Copying ..." and "Creating ..." messages. * gnulib-tool (func_import): Omit $destdir/ from the "Updating"/ "Creating" messages regarding .gitignore files. * pygnulib/GLImport.py (GLImport._update_ignorelist_): Likewise. --- ChangeLog | 7 +++++++ gnulib-tool | 8 ++++---- pygnulib/GLImport.py | 14 +++++++------- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index e5af4e34c0..5396f935a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2022-08-06 Bruno Haible + gnulib-tool: In the VC files messages, omit the destination directory. + This makes these messages consistent with the other "Copying ..." and + "Creating ..." messages. + * gnulib-tool (func_import): Omit $destdir/ from the "Updating"/ + "Creating" messages regarding .gitignore files. + * pygnulib/GLImport.py (GLImport._update_ignorelist_): Likewise. + gnulib-tool.py: Fix output in --dry-run mode. * pygnulib/GLImport.py (GLImport._update_ignorelist_): In dry-run mode, say "Update", not "Updating". diff --git a/gnulib-tool b/gnulib-tool index ac53480dbf..e49d1bc8a8 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -6221,7 +6221,7 @@ s,//*$,/,' ) if test -s "$tmp"/ignore-added || test -s "$tmp"/ignore-removed; then if $doit; then - echo "Updating $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)" + echo "Updating $dir$ignore (backup in $dir${ignore}~)" mv -f "$destdir/$dir$ignore" "$destdir/$dir$ignore"~ { sed -e 's,/,\\/,g' -e 's,^,/^,' -e 's,$,\$/d,' < "$tmp"/ignore-removed if test -n "$anchor"; then sed -e 's,/,\\/,g' -e "s,^,/^${doubly_escaped_anchor}," -e 's,$,$/d,' < "$tmp"/ignore-removed; fi @@ -6231,14 +6231,14 @@ s,//*$,/,' } | sed -f "$tmp"/sed-ignore-removed \ > "$destdir/$dir$ignore" else - echo "Update $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)" + echo "Update $dir$ignore (backup in $dir${ignore}~)" fi fi fi else if test -n "$dir_added"; then if $doit; then - echo "Creating $destdir/$dir$ignore" + echo "Creating $dir$ignore" { if test "$ignore" = .cvsignore; then echo ".deps" @@ -6248,7 +6248,7 @@ s,//*$,/,' echo "$dir_added" | sed -e '/^$/d' -e "s|^|$anchor|" | LC_ALL=C sort -u } > "$destdir/$dir$ignore" else - echo "Create $destdir/$dir$ignore" + echo "Create $dir$ignore" fi fi fi diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py index 13418400af..935a662593 100644 --- a/pygnulib/GLImport.py +++ b/pygnulib/GLImport.py @@ -710,11 +710,11 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix anchor = '/' else: anchor = '' - srcpath = joinpath(destdir, directory, ignore) + srcpath = joinpath(directory, ignore) backupname = '%s~' % srcpath - if isfile(srcpath): + if isfile(joinpath(destdir, srcpath)): if dirs_added or dirs_removed: - with codecs.open(srcpath, 'rb', 'UTF-8') as file: + with codecs.open(joinpath(destdir, srcpath), 'rb', 'UTF-8') as file: srcdata = file.read() dirs_ignore = sorted(set(srcdata.split('\n'))) dirs_ignore = [ line @@ -734,13 +734,13 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix if srcdata != destdata: if not self.config['dryrun']: print('Updating %s (backup in %s)' % (srcpath, backupname)) - copyfile2(srcpath, backupname) + copyfile2(joinpath(destdir, srcpath), joinpath(destdir, backupname)) result = '' - with codecs.open(srcpath, 'ab', 'UTF-8') as file: + with codecs.open(joinpath(destdir, srcpath), 'ab', 'UTF-8') as file: file.write(destdata) else: # if self.config['dryrun'] print('Update %s (backup in %s)' % (srcpath, backupname)) - else: # if not isfile(srcpath) + else: # if not isfile(joinpath(destdir, srcpath)) if dirs_added: if not self.config['dryrun']: print('Creating %s' % srcpath) @@ -749,7 +749,7 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix for d in dirs_added ] if ignore == '.cvsignore': dirs_added = ['.deps', '.dirstamp'] + dirs_added - with codecs.open(srcpath, 'wb', 'UTF-8') as file: + with codecs.open(joinpath(destdir, srcpath), 'wb', 'UTF-8') as file: file.write('\n'.join(dirs_added)) file.write('\n') else: # if self.config['dryrun'] -- 2.39.5