mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
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>
This commit is contained in:
1 parent
534b3d0995
commit
c60f9e4360
2 files changed
+9
-2
No files matched your search
@@ -16,7 +16,7 @@ all: build
|
||||
GOXL_GEN_FILES = types.gen.go helpers.gen.go
|
||||
|
||||
%.gen.go: gengotypes.py $(LIBXL_SRC_DIR)/libxl_types.idl $(LIBXL_SRC_DIR)/idl.py
|
||||
XEN_ROOT=$(XEN_ROOT) $(PYTHON) gengotypes.py $(LIBXL_SRC_DIR)/libxl_types.idl
|
||||
LIBXL_SRC_DIR=$(LIBXL_SRC_DIR) $(PYTHON) gengotypes.py $(LIBXL_SRC_DIR)/libxl_types.idl
|
||||
|
||||
# Go will do its own dependency checking, and not actuall go through
|
||||
# with the build if none of the input files have changed.
|
||||
|
||||
@@ -3,7 +3,14 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.append('{0}/tools/libxl'.format(os.environ['XEN_ROOT']))
|
||||
try:
|
||||
sys.path.append(os.environ['LIBXL_SRC_DIR'])
|
||||
except:
|
||||
# If we get here, then we expect the 'import idl'
|
||||
# expression to fail. That error is more informative,
|
||||
# so let it happen.
|
||||
pass
|
||||
|
||||
import idl
|
||||
|
||||
# Go versions of some builtin types.
|
||||
|
||||