Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Jun 2021 20:00:32 GMT
From:      Ceri Davies <ceri@FreeBSD.org>
To:        doc-committers@FreeBSD.org, dev-commits-doc-all@FreeBSD.org
Subject:   git: 55ff91a87b - main - documentation/tools: warn, but don't fail, on languages without books.
Message-ID:  <202106162000.15GK0Wg3098866@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by ceri:

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

commit 55ff91a87b9b8de6af8ae5a871af3f5b46a7b747
Author:     Ceri Davies <ceri@FreeBSD.org>
AuthorDate: 2021-06-16 13:11:00 +0000
Commit:     Ceri Davies <ceri@FreeBSD.org>
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]
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202106162000.15GK0Wg3098866>