[oe-commits] [openembedded-core] 11/40: scriptutils: pass in logger as parameter

git at git.openembedded.org git at git.openembedded.org
Fri Jul 21 11:37:55 UTC 2017


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 21f04b61973dd9029f0e6bff5445e31cd762bf32
Author: Chang Rebecca Swee Fun <rebecca.swee.fun.chang at intel.com>
AuthorDate: Wed Jun 28 09:59:18 2017 +0800

    scriptutils: pass in logger as parameter
    
    logger was not defined in scriptutils.py based on the
    observation in python traceback.
    
    Traceback (most recent call last):
      File "/workdir/poky/scripts/devtool", line 351, in <module>
        ret = main()
      File "/workdir/poky/scripts/devtool", line 338, in main
        ret = args.func(args, config, basepath, workspace)
      File "/workdir/poky/scripts/lib/devtool/utilcmds.py", line 55, in
    edit_recipe
        return scriptutils.run_editor(find_recipe(args, config, basepath,
    workspace))
      File "/workdir/poky/scripts/lib/scriptutils.py", line 141, in
    run_editor
        logger.error("Execution of '%s' failed: %s" % (editor, exc))
    NameError: name 'logger' is not defined
    
    We pass in logger as parameter to run_editor() from where it has
    been called (devtool/utilcmds.py and recipetool/newappend.py),
    which both modules already has logger setup.
    
    Signed-off-by: Chang Rebecca Swee Fun <rebecca.swee.fun.chang at intel.com>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 scripts/lib/devtool/utilcmds.py     | 2 +-
 scripts/lib/recipetool/newappend.py | 2 +-
 scripts/lib/scriptutils.py          | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/lib/devtool/utilcmds.py b/scripts/lib/devtool/utilcmds.py
index 0437e64..938d88a 100644
--- a/scripts/lib/devtool/utilcmds.py
+++ b/scripts/lib/devtool/utilcmds.py
@@ -49,7 +49,7 @@ def edit_recipe(args, config, basepath, workspace):
             raise DevtoolError("Recipe file for %s is not under the workspace" %
                                args.recipename)
 
-    return scriptutils.run_editor(recipefile)
+    return scriptutils.run_editor(recipefile, logger)
 
 
 def configure_help(args, config, basepath, workspace):
diff --git a/scripts/lib/recipetool/newappend.py b/scripts/lib/recipetool/newappend.py
index 0b63759..decce83 100644
--- a/scripts/lib/recipetool/newappend.py
+++ b/scripts/lib/recipetool/newappend.py
@@ -74,7 +74,7 @@ def newappend(args):
             return 1
 
     if args.edit:
-        return scriptutils.run_editor([append_path, recipe_path])
+        return scriptutils.run_editor([append_path, recipe_path], logger)
     else:
         print(append_path)
 
diff --git a/scripts/lib/scriptutils.py b/scripts/lib/scriptutils.py
index b6217dc..9785438 100644
--- a/scripts/lib/scriptutils.py
+++ b/scripts/lib/scriptutils.py
@@ -205,7 +205,7 @@ def fetch_url(tinfoil, srcuri, srcrev, destdir, logger, preserve_tmp=False):
     return checksums, tmpdir
 
 
-def run_editor(fn):
+def run_editor(fn, logger=None):
     if isinstance(fn, str):
         params = '"%s"' % fn
     else:

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list