]> code.ossystems Code Review - openembedded-core.git/commitdiff
scripts/oe-selftest: fix startup backtrace
authorAlexandru DAMIAN <alexandru.damian@intel.com>
Wed, 4 Feb 2015 14:13:56 +0000 (14:13 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 7 Feb 2015 18:52:45 +0000 (18:52 +0000)
Fixing a backtrace dump that happens if the script is started
without sourcing the oe-init-build-env first.

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
scripts/oe-selftest

index 2332b224ee9ce2b92c1121c2f132b1718473288a..74c998bc4394180eb11611d72fd5db1b12ce9217 100755 (executable)
@@ -102,6 +102,8 @@ def add_include():
 
 def remove_include():
     builddir = os.environ.get("BUILDDIR")
+    if builddir is None:
+        return
     if "#include added by oe-selftest.py" \
         in ftools.read_file(os.path.join(builddir, "conf/local.conf")):
             log.info("Removing the include from local.conf")
@@ -116,7 +118,7 @@ def remove_inc_files():
             for f in files:
                 if f == 'test_recipe.inc':
                     os.remove(os.path.join(root, f))
-    except OSError as e:
+    except (AttributeError, OSError,) as e:    # AttributeError may happen if BUILDDIR is not set
         pass
 
 def get_tests(exclusive_modules=[], include_hidden=False):