[gi-docgen/wip/carlosg/multi-content-dir: 2/5] genindices: Handle multiple --content-dir arguments




commit 667c7a30eeaf3b4a8737da46ea5534dc86a143e3
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Jun 6 00:25:17 2021 +0200

    genindices: Handle multiple --content-dir arguments
    
    In some circumstances it's useful to specify multiple content
    directories. Handle these here (although not much is done with
    does in index generation).

 gidocgen/gdgenindices.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/gidocgen/gdgenindices.py b/gidocgen/gdgenindices.py
index da8846b..336fea4 100644
--- a/gidocgen/gdgenindices.py
+++ b/gidocgen/gdgenindices.py
@@ -685,7 +685,7 @@ def _gen_unions(config, stemmer, index, repository, symbols):
             add_index_terms(index_terms, utils.index_description(func_desc, stemmer), func_idx)
 
 
-def gen_indices(config, repository, content_dir, output_dir):
+def gen_indices(config, repository, content_dirs, output_dir):
     namespace = repository.namespace
 
     symbols = {
@@ -762,7 +762,7 @@ def add_args(parser):
     parser.add_argument("--add-include-path", action="append", dest="include_paths", default=[],
                         help="include paths for other GIR files")
     parser.add_argument("-C", "--config", metavar="FILE", help="the configuration file")
-    parser.add_argument("--content-dir", default=None, help="the base directory with the extra content")
+    parser.add_argument("--content-dir", action="append", dest="content_dirs", default=[], help="the base 
directories with the extra content")
     parser.add_argument("--dry-run", action="store_true", help="parses the GIR file without generating 
files")
     parser.add_argument("--output-dir", default=None, help="the output directory for the index files")
     parser.add_argument("infile", metavar="GIRFILE", type=argparse.FileType('r', encoding='UTF-8'),
@@ -775,9 +775,12 @@ def run(options):
     conf = config.GIDocConfig(options.config)
 
     output_dir = options.output_dir or os.getcwd()
-    content_dir = options.content_dir or os.getcwd()
     log.info(f"Output directory: {output_dir}")
 
+    content_dirs = options.content_dirs;
+    if content_dirs == []:
+      content_dirs = [os.getcwd()]
+
     paths = []
     paths.extend(options.include_paths)
     paths.extend(utils.default_search_paths())
@@ -789,6 +792,6 @@ def run(options):
 
     if not options.dry_run:
         log.checkpoint()
-        gen_indices(conf, parser.get_repository(), content_dir, output_dir)
+        gen_indices(conf, parser.get_repository(), content_dirs, output_dir)
 
     return 0


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