golang/xenlight: do not hard code libxl dir in gengotypes.py
authorNick Rosbrook <rosbrookn@gmail.com>
Sun, 11 Oct 2020 23:31:24 +0000 (19:31 -0400)
committerWei Liu <wl@xen.org>
Tue, 13 Oct 2020 13:30:53 +0000 (13:30 +0000)
commitc60f9e4360ec857bb0164387378e12ae8e66e189
tree58251ff4518c5ca2889f150c01b54b3e91aa7161
parent534b3d09958fdc4df64872c2ab19feb4b1eebc5a
golang/xenlight: do not hard code libxl dir in gengotypes.py

Currently, in order to 'import idl' in gengotypes.py, we derive the path
of the libxl source directory from the XEN_ROOT environment variable, and
append that to sys.path so python can see idl.py. Since the the recent move of
libxl to tools/libs/light, this hard coding breaks the build.

Instead, check for the environment variable LIBXL_SRC_DIR, but move this
check to a try-except block (with empty except). This simply makes the
real error more visible, and does not strictly require that
LIBXL_SRC_DIR is used. Finally, update the Makefile to set LIBXL_SRC_DIR
rather than XEN_ROOT when calling gengotypes.py.

Signed-off-by: Nick Rosbrook <rosbrookn@ainfosec.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
tools/golang/xenlight/Makefile
tools/golang/xenlight/gengotypes.py