]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
bitbake: utils: Fix movefile() exception handling with python3
authorMartin Jansa <martin.jansa@gmail.com>
Tue, 3 Sep 2019 07:49:56 +0000 (07:49 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 3 Sep 2019 09:18:58 +0000 (10:18 +0100)
* 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

(Bitbake rev: d6e43c443ddbbe467c4380c48d2bc28ae18504a1)

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bitbake/lib/bb/utils.py

index 0618e46fe67f0c4636b1322769c1748c1ddbeff5..3e90b6a3069dd9ca8aecdeb1639bf25d19c77b60 100644 (file)
@@ -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