[gi-docgen/wip/carlosg/multi-content-dir: 3/5] gendeps: Handle multiple --content-dir arguments
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gi-docgen/wip/carlosg/multi-content-dir: 3/5] gendeps: Handle multiple --content-dir arguments
- Date: Sat, 5 Jun 2021 22:51:36 +0000 (UTC)
commit 8e115f14d45473b87bebc8ad70315e9269db7b60
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun Jun 6 00:26:52 2021 +0200
gendeps: Handle multiple --content-dir arguments
In some circumstances it's useful to specify multiple content
directories. Handle these here, looking up content files in
all directories.
gidocgen/gdgendeps.py | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/gidocgen/gdgendeps.py b/gidocgen/gdgendeps.py
index 89cac7f..f7b1cb0 100644
--- a/gidocgen/gdgendeps.py
+++ b/gidocgen/gdgendeps.py
@@ -11,17 +11,17 @@ from . import config, gir, log, utils
HELP_MSG = "Generates the build dependencies"
-def _gen_content_files(config, content_dir):
+def _gen_content_files(config, content_dirs):
content_files = []
for file_name in config.content_files:
- content_files.append(os.path.join(content_dir, file_name))
+ content_files.append(utils.find_extra_content_file(content_dirs, file_name))
return content_files
-def _gen_content_images(config, content_dir):
+def _gen_content_images(config, content_dirs):
content_images = []
for image_file in config.content_images:
- content_images.append(os.path.join(content_dir, image_file))
+ content_images.append(utils.find_extra_content_file(content_dirs, image_file))
return content_images
@@ -40,14 +40,16 @@ def gen_dependencies(repository, config, options):
outfile.write(repository.girfile)
outfile.write("\n")
- content_dir = options.content_dir or os.getcwd()
+ content_dirs = options.content_dirs
+ if content_dirs == []:
+ content_dirs = [os.getcwd()]
- content_files = _gen_content_files(config, content_dir)
+ content_files = _gen_content_files(config, content_dirs)
for f in content_files:
outfile.write(f)
outfile.write("\n")
- content_images = _gen_content_images(config, content_dir)
+ content_images = _gen_content_images(config, content_dirs)
for f in content_images:
outfile.write(f)
outfile.write("\n")
@@ -57,7 +59,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("infile", metavar="GIRFILE", type=argparse.FileType('r', encoding='UTF-8'),
default=sys.stdin, help="the GIR file to parse")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]