git: 55ff91a87b - main - documentation/tools: warn, but don't fail, on languages without books.

Ceri Davies <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.doc
Message-ID <[email protected]>
The branch main has been updated by ceri:

URL: https://cgit.FreeBSD.org/doc/commit/?id=55ff91a87b9b8de6af8ae5a871af3f5b46a7b747

commit 55ff91a87b9b8de6af8ae5a871af3f5b46a7b747
Author:     Ceri Davies <[email protected]>
AuthorDate: 2021-06-16 13:11:00 +0000
Commit:     Ceri Davies <[email protected]>
CommitDate: 2021-06-16 20:00:26 +0000

    documentation/tools: warn, but don't fail, on languages without books.
    
    This allows us to pass a full list of languages to the pdf target.
    The -o option does not warn, continuing merely to print a list of files
    that it would create.
---
 documentation/tools/books-toc-creator.py          | 6 ++++++
 documentation/tools/books-toc-examples-creator.py | 6 ++++++
 documentation/tools/books-toc-figures-creator.py  | 6 ++++++
 documentation/tools/books-toc-parts-creator.py    | 5 +++++
 documentation/tools/books-toc-tables-creator.py   | 6 ++++++
 5 files changed, 29 insertions(+)

diff --git a/documentation/tools/books-toc-creator.py b/documentation/tools/books-toc-creator.py
index bd85b7e923..33b15ca1ff 100644
--- a/documentation/tools/books-toc-creator.py
+++ b/documentation/tools/books-toc-creator.py
@@ -9,6 +9,7 @@ This script will generate the Table of Contents of the books.
 
 import sys, getopt
 import re
+import os.path
 
 languages = []
 
@@ -147,6 +148,11 @@ def main(argv):
 
   for language in langargs:
 
+    if not os.path.exists('./content/{}/books/books.adoc'.format(language)):
+      if not justPrintOutput:
+        print('Warning: no books found for language "{0}"'.format(language))
+      continue
+
     with open('./content/{}/books/books.adoc'.format(language), 'r', encoding = 'utf-8') as booksFile:
       books = [line.strip() for line in booksFile]
 
diff --git a/documentation/tools/books-toc-examples-creator.py b/documentation/tools/books-toc-examples-creator.py
index 423239c30d..638073d397 100644
--- a/documentation/tools/books-toc-examples-creator.py
+++ b/documentation/tools/books-toc-examples-creator.py
@@ -12,6 +12,7 @@ books.
 
 import sys, getopt
 import re
+import os.path
 
 languages = []
 
@@ -78,6 +79,11 @@ def main(argv):
 
   for language in langargs:
 
+    if not os.path.exists('./content/{}/books/books.adoc'.format(language)):
+      if not justPrintOutput:
+        print('Warning: no books found for language "{0}"'.format(language))
+      continue
+
     with open('./content/{}/books/books.adoc'.format(language), 'r', encoding = 'utf-8') as booksFile:
       books = [line.strip() for line in booksFile]
 
diff --git a/documentation/tools/books-toc-figures-creator.py b/documentation/tools/books-toc-figures-creator.py
index fbe1d62c65..db8b06c639 100644
--- a/documentation/tools/books-toc-figures-creator.py
+++ b/documentation/tools/books-toc-figures-creator.py
@@ -12,6 +12,7 @@ in the books.
 
 import sys, getopt
 import re
+import os.path
 
 languages = []
 
@@ -78,6 +79,11 @@ def main(argv):
 
   for language in langargs:
 
+    if not os.path.exists('./content/{}/books/books.adoc'.format(language)):
+      if not justPrintOutput:
+        print('Warning: no books found for language "{0}"'.format(language))
+      continue
+
     with open('./content/{}/books/books.adoc'.format(language), 'r', encoding = 'utf-8') as booksFile:
       books = [line.strip() for line in booksFile]
 
diff --git a/documentation/tools/books-toc-parts-creator.py b/documentation/tools/books-toc-parts-creator.py
index aeb035b8cb..98d1636953 100644
--- a/documentation/tools/books-toc-parts-creator.py
+++ b/documentation/tools/books-toc-parts-creator.py
@@ -144,6 +144,11 @@ def main(argv):
 
   for language in langargs:
 
+    if not os.path.exists('./content/{}/books/books.adoc'.format(language)):
+      if not justPrintOutput:
+        print('Warning: no books found for language "{0}"'.format(language))
+      continue
+
     with open('./content/{}/books/books.adoc'.format(language), 'r', encoding = 'utf-8') as booksFile:
       books = [line.strip() for line in booksFile]
 
diff --git a/documentation/tools/books-toc-tables-creator.py b/documentation/tools/books-toc-tables-creator.py
index 67f1733d45..049098914a 100644
--- a/documentation/tools/books-toc-tables-creator.py
+++ b/documentation/tools/books-toc-tables-creator.py
@@ -11,6 +11,7 @@ This script will generate the Table of Contents for tables in the books.
 
 import sys, getopt
 import re
+import os.path
 
 languages = []
 
@@ -77,6 +78,11 @@ def main(argv):
 
   for language in langargs:
 
+    if not os.path.exists('./content/{}/books/books.adoc'.format(language)):
+      if not justPrintOutput:
+        print('Warning: no books found for language "{0}"'.format(language))
+      continue
+
     with open('./content/{}/books/books.adoc'.format(language), 'r', encoding = 'utf-8') as booksFile:
       books = [line.strip() for line in booksFile]
 
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-doc-all
To unsubscribe, send any mail to "[email protected]"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.