[oe-commits] [bitbake] 01/02: utils: Fix movefile() exception handling with python3

git at git.openembedded.org git at git.openembedded.org
Tue Sep 3 09:19:34 UTC 2019


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

rpurdie pushed a commit to branch master
in repository bitbake.

commit d6e43c443ddbbe467c4380c48d2bc28ae18504a1
Author: Martin Jansa <martin.jansa at gmail.com>
AuthorDate: Tue Sep 3 07:49:56 2019 +0000

    utils: Fix movefile() exception handling with python3
    
    * with python3 this fails with:
      File: 'bitbake/lib/bb/utils.py', lineno: 799, function: movefile
           0795:        try:
           0796:            os.rename(src, destpath)
           0797:            renamefailed = 0
           0798:        except Exception as e:
       *** 0799:            if e[0] != errno.EXDEV:
           0800:                # Some random error.
           0801:                print("movefile: Failed to move", src, "to", dest, e)
           0802:                return None
           0803:            # Invalid cross-device-link 'bind' mounted or actually Cross-Device
      Exception: TypeError: 'OSError' object is not subscriptable
    
    Signed-off-by: Martin Jansa <Martin.Jansa at gmail.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/utils.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index 0618e46..3e90b6a 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -780,7 +780,7 @@ def movefile(src, dest, newmtime = None, sstat = None):
             os.rename(src, destpath)
             renamefailed = 0
         except Exception as e:
-            if e[0] != errno.EXDEV:
+            if e.errno != errno.EXDEV:
                 # Some random error.
                 print("movefile: Failed to move", src, "to", dest, e)
                 return None

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


More information about the Openembedded-commits mailing list