build: library paths as parameters for generate-settings-docs.py

generate-settings-docs.py script uses the `LD_LIBRARY_PATH` to
prepend directories to the library search path, which is useful to
load a just built libnm shared library, when generating the
`nm-settings-docs.xml` and `nm-property-docs.xml` files.

However, this is a problem for meson, which is not able to set
environment variables when executing the script.

This patch adds a new optional parameter, `-l` or `--lib-path` that
can be used to pass different paths to be prepended without using
the `LD_LIBRARY_PATH` environment, which can still be used.

[thaller@redhat.com: fix script to handle None lib_path argument]

https://mail.gnome.org/archives/networkmanager-list/2017-December/msg00044.html
This commit is contained in:
Iñigo Martínez
2017-12-14 12:40:12 +01:00
committed by Thomas Haller
parent 7d074fa6df
commit 9fc990e8a9

View File

@@ -183,6 +183,7 @@ def usage():
exit()
parser = argparse.ArgumentParser()
parser.add_argument('-l', '--lib-path', metavar='PATH', action='append', help='path to scan for shared libraries')
parser.add_argument('-g', '--gir', metavar='FILE', help='NM-1.0.gir file')
parser.add_argument('-x', '--overrides', metavar='FILE', help='documentation overrides file')
parser.add_argument('-o', '--output', metavar='FILE', help='output file')
@@ -191,6 +192,10 @@ args = parser.parse_args()
if args.gir is None or args.output is None:
usage()
if args.lib_path:
for lib in args.lib_path:
GIRepository.Repository.prepend_library_path(lib)
girxml = ET.parse(args.gir).getroot()
outfile = open(args.output, mode='w')