summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/filemap.py
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2018-11-05 11:23:03 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-11-07 23:08:55 +0000
commitff842fe7771e399498264e14fa04a1d7935322a3 (patch)
tree3790c37990c347cb78f9a307befa453378c95b40 /scripts/lib/wic/filemap.py
parent36df73a52342b9f37b70bfd24c0c8cce5f75f11f (diff)
downloadpoky-ff842fe7771e399498264e14fa04a1d7935322a3.tar.gz
wic: use explicit errno import
os.errno doesn't work in Python 3.7 and shouldn't have ever worked, so use import errno explicitly. (From OE-Core rev: 82f9157e84dcaf0ad4292053b09be68c2290d197) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic/filemap.py')
-rw-r--r--scripts/lib/wic/filemap.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/scripts/lib/wic/filemap.py b/scripts/lib/wic/filemap.py
index a72fa09ef5..abbf958b8c 100644
--- a/scripts/lib/wic/filemap.py
+++ b/scripts/lib/wic/filemap.py
@@ -22,6 +22,7 @@ and returns an instance of the class.
22# * Too many instance attributes (R0902) 22# * Too many instance attributes (R0902)
23# pylint: disable=R0902 23# pylint: disable=R0902
24 24
25import errno
25import os 26import os
26import struct 27import struct
27import array 28import array
@@ -189,9 +190,9 @@ def _lseek(file_obj, offset, whence):
189 except OSError as err: 190 except OSError as err:
190 # The 'lseek' system call returns the ENXIO if there is no data or 191 # The 'lseek' system call returns the ENXIO if there is no data or
191 # hole starting from the specified offset. 192 # hole starting from the specified offset.
192 if err.errno == os.errno.ENXIO: 193 if err.errno == errno.ENXIO:
193 return -1 194 return -1
194 elif err.errno == os.errno.EINVAL: 195 elif err.errno == errno.EINVAL:
195 raise ErrorNotSupp("the kernel or file-system does not support " 196 raise ErrorNotSupp("the kernel or file-system does not support "
196 "\"SEEK_HOLE\" and \"SEEK_DATA\"") 197 "\"SEEK_HOLE\" and \"SEEK_DATA\"")
197 else: 198 else:
@@ -394,12 +395,12 @@ class FilemapFiemap(_FilemapBase):
394 except IOError as err: 395 except IOError as err:
395 # Note, the FIEMAP ioctl is supported by the Linux kernel starting 396 # Note, the FIEMAP ioctl is supported by the Linux kernel starting
396 # from version 2.6.28 (year 2008). 397 # from version 2.6.28 (year 2008).
397 if err.errno == os.errno.EOPNOTSUPP: 398 if err.errno == errno.EOPNOTSUPP:
398 errstr = "FilemapFiemap: the FIEMAP ioctl is not supported " \ 399 errstr = "FilemapFiemap: the FIEMAP ioctl is not supported " \
399 "by the file-system" 400 "by the file-system"
400 self._log.debug(errstr) 401 self._log.debug(errstr)
401 raise ErrorNotSupp(errstr) 402 raise ErrorNotSupp(errstr)
402 if err.errno == os.errno.ENOTTY: 403 if err.errno == errno.ENOTTY:
403 errstr = "FilemapFiemap: the FIEMAP ioctl is not supported " \ 404 errstr = "FilemapFiemap: the FIEMAP ioctl is not supported " \
404 "by the kernel" 405 "by the kernel"
405 self._log.debug(errstr) 406 self._log.debug(errstr)