[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: Add a interface to register errors from init file
From: |
Patrice Dumas |
Subject: |
branch master updated: Add a interface to register errors from init files |
Date: |
Sun, 07 Aug 2022 14:31:40 -0400 |
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 190dbcb334 Add a interface to register errors from init files
190dbcb334 is described below
commit 190dbcb334c3870f3eb2acd36866bf2df88455f8
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Aug 7 20:30:59 2022 +0200
Add a interface to register errors from init files
* tp/Texinfo/Config.pm (GNUT_load_init_file)
(texinfo_register_init_loading_failure): add
texinfo_register_init_loading_failure() to register errors
from init files.
* tp/ext/epub3.pm: register an error if require Archive::Zip;
fails.
---
ChangeLog | 12 ++++++++++++
tp/Texinfo/Config.pm | 14 ++++++++++++++
tp/ext/epub3.pm | 8 ++++++--
3 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8b559eb1cc..5df412fd02 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2022-08-06 Gavin Smith <gavinsmith0123@gmail.com>
+
+ Add a interface to register errors from init files
+
+ * tp/Texinfo/Config.pm (GNUT_load_init_file)
+ (texinfo_register_init_loading_failure): add
+ texinfo_register_init_loading_failure() to register errors
+ from init files.
+
+ * tp/ext/epub3.pm: register an error if require Archive::Zip;
+ fails.
+
2022-08-07 Patrice Dumas <pertusus@free.fr>
Use CSS for horizontal alignement in table cells
diff --git a/tp/Texinfo/Config.pm b/tp/Texinfo/Config.pm
index afe4dd81f2..a3e8eb06bb 100644
--- a/tp/Texinfo/Config.pm
+++ b/tp/Texinfo/Config.pm
@@ -119,6 +119,7 @@ sub _GNUT_document_warn($) {
"%s: warning: %s\n"), $real_command_name, $text)));
}
+my @init_file_loading_errors;
# called from texi2any.pl main program.
# eval $FILE in the Texinfo::Config namespace. $FILE should be a binary string.
sub GNUT_load_init_file($) {
@@ -133,6 +134,19 @@ sub GNUT_load_init_file($) {
_GNUT_document_warn(sprintf(__("error loading %s: %s"),
_GNUT_decode_input($file), $e));
}
+ for my $error (@init_file_loading_errors) {
+ warn sprintf(__("error loading %s: %s"),
+ _GNUT_decode_input($file), $error)."\n";
+ }
+ if (scalar(@init_file_loading_errors)) {
+ exit 1;
+ }
+}
+
+# called from init files in case of errors.
+sub texinfo_register_init_loading_failure($) {
+ my $error = shift;
+ push @init_file_loading_errors, $error;
}
# L2H removed in 2021
diff --git a/tp/ext/epub3.pm b/tp/ext/epub3.pm
index d94cdc0dc7..2f6767a17d 100644
--- a/tp/ext/epub3.pm
+++ b/tp/ext/epub3.pm
@@ -78,6 +78,12 @@ use Texinfo::Common;
use Texinfo::Convert::Utils;
use Texinfo::Convert::Text;
+eval { require Archive::Zip; };
+
+if ($@) {
+ texinfo_register_init_loading_failure("Archive::Zip is required for EPUB
output");
+}
+
# the 3.2 spec was used for the implementation. However, it seems to be
# designed to be backward compatible with 3.0 and mandates to use 3.0 as
# version.
@@ -829,8 +835,6 @@ EOT
}
if ($self->get_conf('EPUB_CREATE_CONTAINER_FILE')) {
- require Archive::Zip;
-
# this is needed if there are non ascii file names, otherwise, for instance
# with calibre the files cannot be read, one get
# "There is no item named 'EPUB/osé.opf' in the archive"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: Add a interface to register errors from init files,
Patrice Dumas <=