diff mbox series

[U-Boot,v2,17/37] binman: Ensure that coverage has access to site packages

Message ID 20190708191856.138863-18-sjg@chromium.org
State Accepted
Commit 86679cefe5fd3d24ccc4dc117c9e1b107f60c937
Delegated to: Simon Glass
Headers show
Series binman: Add CBFS support | expand

Commit Message

Simon Glass July 8, 2019, 7:18 p.m. UTC
Code coverage tests fail on binman due to dist-packages being dropped from
the python path on Ubuntu 16.04. Add them in so that we can find the
elffile module, which is required by binman.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 tools/binman/binman.py | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Simon Glass July 18, 2019, 1:59 a.m. UTC | #1
Code coverage tests fail on binman due to dist-packages being dropped from
the python path on Ubuntu 16.04. Add them in so that we can find the
elffile module, which is required by binman.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 tools/binman/binman.py | 8 ++++++++
 1 file changed, 8 insertions(+)

Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/tools/binman/binman.py b/tools/binman/binman.py
index 9f8c5c99b79..05aeaecd8f3 100755
--- a/tools/binman/binman.py
+++ b/tools/binman/binman.py
@@ -11,9 +11,11 @@ 
 
 from __future__ import print_function
 
+from distutils.sysconfig import get_python_lib
 import glob
 import multiprocessing
 import os
+import site
 import sys
 import traceback
 import unittest
@@ -28,6 +30,12 @@  sys.path.insert(0, 'scripts/dtc/pylibfdt')
 sys.path.insert(0, os.path.join(our_path,
                 '../../build-sandbox_spl/scripts/dtc/pylibfdt'))
 
+# When running under python-coverage on Ubuntu 16.04, the dist-packages
+# directories are dropped from the python path. Add them in so that we can find
+# the elffile module. We could use site.getsitepackages() here but unfortunately
+# that is not available in a virtualenv.
+sys.path.append(get_python_lib())
+
 import cmdline
 import command
 use_concurrent = True