summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/parse/__init__.py7
-rw-r--r--bitbake/lib/bb/parse/parse_py/ConfHandler.py21
2 files changed, 18 insertions, 10 deletions
diff --git a/bitbake/lib/bb/parse/__init__.py b/bitbake/lib/bb/parse/__init__.py
index 4a78e183ab..1becaa4f02 100644
--- a/bitbake/lib/bb/parse/__init__.py
+++ b/bitbake/lib/bb/parse/__init__.py
@@ -26,9 +26,10 @@ File parsers for the BitBake build tools.
26 26
27handlers = [] 27handlers = []
28 28
29import errno
30import logging
29import os 31import os
30import stat 32import stat
31import logging
32import bb 33import bb
33import bb.utils 34import bb.utils
34import bb.siggen 35import bb.siggen
@@ -122,12 +123,12 @@ def resolve_file(fn, d):
122 for af in attempts: 123 for af in attempts:
123 mark_dependency(d, af) 124 mark_dependency(d, af)
124 if not newfn: 125 if not newfn:
125 raise IOError("file %s not found in %s" % (fn, bbpath)) 126 raise IOError(errno.ENOENT, "file %s not found in %s" % (fn, bbpath))
126 fn = newfn 127 fn = newfn
127 128
128 mark_dependency(d, fn) 129 mark_dependency(d, fn)
129 if not os.path.isfile(fn): 130 if not os.path.isfile(fn):
130 raise IOError("file %s not found" % fn) 131 raise IOError(errno.ENOENT, "file %s not found" % fn)
131 132
132 return fn 133 return fn
133 134
diff --git a/bitbake/lib/bb/parse/parse_py/ConfHandler.py b/bitbake/lib/bb/parse/parse_py/ConfHandler.py
index 250a557cb4..fbd75b14ad 100644
--- a/bitbake/lib/bb/parse/parse_py/ConfHandler.py
+++ b/bitbake/lib/bb/parse/parse_py/ConfHandler.py
@@ -24,8 +24,9 @@
24# with this program; if not, write to the Free Software Foundation, Inc., 24# with this program; if not, write to the Free Software Foundation, Inc.,
25# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 25# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 26
27import re, os 27import errno
28import logging 28import re
29import os
29import bb.utils 30import bb.utils
30from bb.parse import ParseError, resolve_file, ast, logger, handle 31from bb.parse import ParseError, resolve_file, ast, logger, handle
31 32
@@ -92,11 +93,17 @@ def include(parentfn, fn, lineno, data, error_out):
92 logger.warn("Duplicate inclusion for %s in %s" % (fn, data.getVar('FILE', True))) 93 logger.warn("Duplicate inclusion for %s in %s" % (fn, data.getVar('FILE', True)))
93 94
94 try: 95 try:
95 ret = bb.parse.handle(fn, data, True) 96 bb.parse.handle(fn, data, True)
96 except (IOError, OSError): 97 except (IOError, OSError) as exc:
97 if error_out: 98 if exc.errno == errno.ENOENT:
98 raise ParseError("Could not %(error_out)s file %(fn)s" % vars(), parentfn, lineno) 99 if error_out:
99 logger.debug(2, "CONF file '%s' not found", fn) 100 raise ParseError("Could not %s file %s" % (error_out, fn), parentfn, lineno)
101 logger.debug(2, "CONF file '%s' not found", fn)
102 else:
103 if error_out:
104 raise ParseError("Could not %s file %s: %s" % (error_out, fn, exc.strerror), parentfn, lineno)
105 else:
106 raise ParseError("Error parsing %s: %s" % (fn, exc.strerror), parentfn, lineno)
100 107
101# We have an issue where a UI might want to enforce particular settings such as 108# We have an issue where a UI might want to enforce particular settings such as
102# an empty DISTRO variable. If configuration files do something like assigning 109# an empty DISTRO variable. If configuration files do something like assigning