texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: Prepare a script to copy file changing file name


From: Patrice Dumas
Subject: branch master updated: Prepare a script to copy file changing file name encoding
Date: Wed, 09 Mar 2022 21:45:02 -0500

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new a8b85bb007 Prepare a script to copy file changing file name encoding
a8b85bb007 is described below

commit a8b85bb007021cf62d0f2349b1104e3d3d9fde7a
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Mar 10 03:44:18 2022 +0100

    Prepare a script to copy file changing file name encoding
---
 tp/Makefile.am                                     |  1 +
 tp/maintain/copy_change_file_name_encoding.pl      | 67 ++++++++++++++++++++++
 tp/tests/Makefile.am                               |  8 ++-
 .../tests/input/included_lat\303\256n1.texi"       |  0
 4 files changed, 73 insertions(+), 3 deletions(-)

diff --git a/tp/Makefile.am b/tp/Makefile.am
index 3cf247b34e..ec86a98559 100644
--- a/tp/Makefile.am
+++ b/tp/Makefile.am
@@ -268,6 +268,7 @@ AM_TESTS_ENVIRONMENT = srcdir="$(srcdir)"; export srcdir; 
top_srcdir="$(top_srcd
 maintenance_files = \
   maintain/all_tests.sh \
   maintain/change_perl_modules_version.sh \
+  maintain/copy_change_file_name_encoding.pl \
   maintain/language-subtag-registry \
   maintain/regenerate_cmd_tests.sh \
   maintain/regenerate_converters_documentation.sh \
diff --git a/tp/maintain/copy_change_file_name_encoding.pl 
b/tp/maintain/copy_change_file_name_encoding.pl
new file mode 100755
index 0000000000..786faad9bc
--- /dev/null
+++ b/tp/maintain/copy_change_file_name_encoding.pl
@@ -0,0 +1,67 @@
+#! /usr/bin/env perl
+
+# copy_change_file_name_encoding.pl: copy file changing
+# the encoding of the file name
+#
+# Copyright 2022 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License,
+# or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+# Original author: Patrice Dumas <pertusus@free.fr>
+
+use File::Copy;
+use File::Basename;
+use File::Spec;
+
+use Encode qw(from_to);
+
+use Getopt::Long qw(GetOptions);
+
+my $from = 'UTF-8';
+my $to = 'ISO-8859-1';
+my $result_options = Getopt::Long::GetOptions (
+ 'from|f=s' => \$from,
+ 'to|t=s' => \$to,
+);
+
+exit 1 if (!$result_options);
+
+my ($src_path, $dest_dir) = @ARGV;
+
+if (not defined($src_path)) {
+  die "Need source file\n";
+}
+
+my $dest_path;
+if (defined($dest_dir)) {
+  my ($file_name, $dir, $suffix) = fileparse($src_path);
+  $dest_path = File::Spec->catfile($dest_dir, $file_name);
+} else {
+  $dest_path = $src_path;
+}
+
+my $succeeded = from_to($dest_path, $from, $to);
+
+if (not defined($succeeded)) {
+  warn "could not recode $src_path\n";
+  exit(1);
+}
+
+my $copy_succeeded = copy($src_path, $dest_path);
+if (not $copy_succeeded) {
+  warn "could not copy $src_path: $!\n";
+  exit(1);
+}
+
+
diff --git a/tp/tests/Makefile.am b/tp/tests/Makefile.am
index 11e8b1afcb..2677bd1d69 100644
--- a/tp/tests/Makefile.am
+++ b/tp/tests/Makefile.am
@@ -61,7 +61,9 @@ tex-html-checks tex-html-check: all
 other-checks: all
        $(MAKE) $(AM_MAKEFLAGS) check OTHER_TESTS=yes 
TESTS='$(type_other_one_test_files_generated_list)' SUBDIRS=
 
-# FIXME add
-# included_lat*n1.texi
+#check-local:
+#      $(PERL) $(srcdir)/maintain/copy_change_file_name_encoding.pl 
$(serdir)/input/included_latîn1.texi .
+
 EXTRA_DIST = run_parser_all.sh parser_tests.sh \
- $(one_test_files_generated_list) coverage_macro.texi included_akçentêd.texi
+ $(one_test_files_generated_list) coverage_macro.texi included_akçentêd.texi \
+ input/included_latîn1.texi
diff --git "a/tp/tests/included_lat\356n1.texi" 
"b/tp/tests/input/included_lat\303\256n1.texi"
similarity index 100%
rename from "tp/tests/included_lat\356n1.texi"
rename to "tp/tests/input/included_lat\303\256n1.texi"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]