classes: Use modern exception raising syntax
Modern expection rasing syntax is function call format, convert to this to keep python 3 happy and model correct coding style in the core. (From OE-Core rev: f4b382754603d3f1caa13824bcc8d06b568bbc59) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
e0bd393be8
commit
db8217f6b8
|
@ -78,6 +78,6 @@ python __anonymous() {
|
||||||
gtkimmodules_check = d.getVar('GTKIMMODULES_PACKAGES')
|
gtkimmodules_check = d.getVar('GTKIMMODULES_PACKAGES')
|
||||||
if not gtkimmodules_check:
|
if not gtkimmodules_check:
|
||||||
bb_filename = d.getVar('FILE')
|
bb_filename = d.getVar('FILE')
|
||||||
raise bb.build.FuncFailed, "\n\n\nERROR: %s inherits gtk-immodule-cache but doesn't set GTKIMMODULES_PACKAGE" % bb_filename
|
raise bb.build.FuncFailed("ERROR: %s inherits gtk-immodule-cache but doesn't set GTKIMMODULES_PACKAGE" % bb_filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -146,8 +146,8 @@ python systemd_populate_packages() {
|
||||||
if path_found != '':
|
if path_found != '':
|
||||||
systemd_add_files_and_parse(pkg_systemd, path_found, service, keys)
|
systemd_add_files_and_parse(pkg_systemd, path_found, service, keys)
|
||||||
else:
|
else:
|
||||||
raise bb.build.FuncFailed, "\n\nSYSTEMD_SERVICE_%s value %s does not exist" % \
|
raise bb.build.FuncFailed("SYSTEMD_SERVICE_%s value %s does not exist" % \
|
||||||
(pkg_systemd, service)
|
(pkg_systemd, service))
|
||||||
|
|
||||||
# Run all modifications once when creating package
|
# Run all modifications once when creating package
|
||||||
if os.path.exists(d.getVar("D", True)):
|
if os.path.exists(d.getVar("D", True)):
|
||||||
|
|
|
@ -128,9 +128,9 @@ def update_alternatives_after_parse(d):
|
||||||
alt_path = d.getVar('ALTERNATIVE_PATH', True)
|
alt_path = d.getVar('ALTERNATIVE_PATH', True)
|
||||||
alt_link = d.getVar('ALTERNATIVE_LINK', True) or ("%s/%s" % (d.getVar('bindir', True), alt_name))
|
alt_link = d.getVar('ALTERNATIVE_LINK', True) or ("%s/%s" % (d.getVar('bindir', True), alt_name))
|
||||||
if alt_name == None:
|
if alt_name == None:
|
||||||
raise bb.build.build.FuncFailed, "%s inherits update-alternatives but doesn't set ALTERNATIVE_NAME" % d.getVar('FILE')
|
raise bb.build.build.FuncFailed("%s inherits update-alternatives but doesn't set ALTERNATIVE_NAME" % d.getVar('FILE'))
|
||||||
if alt_path == None:
|
if alt_path == None:
|
||||||
raise bb.build.build.FuncFailed, "%s inherits update-alternatives but doesn't set ALTERNATIVE_PATH" % d.getVar('FILE')
|
raise bb.build.build.FuncFailed("%s inherits update-alternatives but doesn't set ALTERNATIVE_PATH" % d.getVar('FILE'))
|
||||||
|
|
||||||
alternative = d.getVar('ALTERNATIVE_%s' % pn, True) or ""
|
alternative = d.getVar('ALTERNATIVE_%s' % pn, True) or ""
|
||||||
alternative += " " + alt_name
|
alternative += " " + alt_name
|
||||||
|
|
|
@ -44,9 +44,9 @@ fi
|
||||||
def update_rc_after_parse(d):
|
def update_rc_after_parse(d):
|
||||||
if d.getVar('INITSCRIPT_PACKAGES') == None:
|
if d.getVar('INITSCRIPT_PACKAGES') == None:
|
||||||
if d.getVar('INITSCRIPT_NAME') == None:
|
if d.getVar('INITSCRIPT_NAME') == None:
|
||||||
raise bb.build.FuncFailed, "%s inherits update-rc.d but doesn't set INITSCRIPT_NAME" % d.getVar('FILE')
|
raise bb.build.FuncFailed("%s inherits update-rc.d but doesn't set INITSCRIPT_NAME" % d.getVar('FILE'))
|
||||||
if d.getVar('INITSCRIPT_PARAMS') == None:
|
if d.getVar('INITSCRIPT_PARAMS') == None:
|
||||||
raise bb.build.FuncFailed, "%s inherits update-rc.d but doesn't set INITSCRIPT_PARAMS" % d.getVar('FILE')
|
raise bb.build.FuncFailed("%s inherits update-rc.d but doesn't set INITSCRIPT_PARAMS" % d.getVar('FILE'))
|
||||||
|
|
||||||
python __anonymous() {
|
python __anonymous() {
|
||||||
update_rc_after_parse(d)
|
update_rc_after_parse(d)
|
||||||
|
|
|
@ -157,11 +157,11 @@ def update_useradd_after_parse(d):
|
||||||
useradd_packages = d.getVar('USERADD_PACKAGES', True)
|
useradd_packages = d.getVar('USERADD_PACKAGES', True)
|
||||||
|
|
||||||
if not useradd_packages:
|
if not useradd_packages:
|
||||||
raise bb.build.FuncFailed, "%s inherits useradd but doesn't set USERADD_PACKAGES" % d.getVar('FILE')
|
raise bb.build.FuncFailed("%s inherits useradd but doesn't set USERADD_PACKAGES" % d.getVar('FILE'))
|
||||||
|
|
||||||
for pkg in useradd_packages.split():
|
for pkg in useradd_packages.split():
|
||||||
if not d.getVar('USERADD_PARAM_%s' % pkg, True) and not d.getVar('GROUPADD_PARAM_%s' % pkg, True):
|
if not d.getVar('USERADD_PARAM_%s' % pkg, True) and not d.getVar('GROUPADD_PARAM_%s' % pkg, True):
|
||||||
raise bb.build.FuncFailed, "%s inherits useradd but doesn't set USERADD_PARAM or GROUPADD_PARAM for package %s" % (d.getVar('FILE'), pkg)
|
raise bb.build.FuncFailed("%s inherits useradd but doesn't set USERADD_PARAM or GROUPADD_PARAM for package %s" % (d.getVar('FILE'), pkg))
|
||||||
|
|
||||||
python __anonymous() {
|
python __anonymous() {
|
||||||
update_useradd_after_parse(d)
|
update_useradd_after_parse(d)
|
||||||
|
|
Loading…
Reference in New Issue