ufoLib, fs calls: Replace deprecated getbytes with readbytes (#1445)
fs 2.2.0 comes with some renamed APIs.
This commit is contained in:
parent
7cbb2da4df
commit
f47fee933c
@ -173,7 +173,7 @@ class _UFOBaseIO(object):
|
||||
"the data is not properly formatted: %s"
|
||||
% (fileName, self.fs, e)
|
||||
)
|
||||
if self.fs.exists(fileName) and data == self.fs.getbytes(fileName):
|
||||
if self.fs.exists(fileName) and data == self.fs.readbytes(fileName):
|
||||
return
|
||||
self.fs.setbytes(fileName, data)
|
||||
else:
|
||||
@ -356,7 +356,7 @@ class UFOReader(_UFOBaseIO):
|
||||
Returns None if the file does not exist.
|
||||
"""
|
||||
try:
|
||||
return self.fs.getbytes(fsdecode(path))
|
||||
return self.fs.readbytes(fsdecode(path))
|
||||
except fs.errors.ResourceNotFound:
|
||||
return None
|
||||
|
||||
@ -758,7 +758,7 @@ class UFOReader(_UFOBaseIO):
|
||||
except AttributeError:
|
||||
# in case readData is called before getDataDirectoryListing
|
||||
dataFS = self.fs.opendir(DATA_DIRNAME)
|
||||
data = dataFS.getbytes(fileName)
|
||||
data = dataFS.readbytes(fileName)
|
||||
except fs.errors.ResourceNotFound:
|
||||
raise UFOLibError("No data file named '%s' on %s" % (fileName, self.fs))
|
||||
return data
|
||||
@ -781,7 +781,7 @@ class UFOReader(_UFOBaseIO):
|
||||
except AttributeError:
|
||||
# in case readImage is called before getImageDirectoryListing
|
||||
imagesFS = self.fs.opendir(IMAGES_DIRNAME)
|
||||
data = imagesFS.getbytes(fileName)
|
||||
data = imagesFS.readbytes(fileName)
|
||||
except fs.errors.ResourceNotFound:
|
||||
raise UFOLibError("No image file named '%s' on %s" % (fileName, self.fs))
|
||||
if validate:
|
||||
@ -1006,7 +1006,7 @@ class UFOWriter(UFOReader):
|
||||
"""
|
||||
path = fsdecode(path)
|
||||
if self._havePreviousFile:
|
||||
if self.fs.isfile(path) and data == self.fs.getbytes(path):
|
||||
if self.fs.isfile(path) and data == self.fs.readbytes(path):
|
||||
return
|
||||
try:
|
||||
self.fs.setbytes(path, data)
|
||||
|
@ -290,7 +290,7 @@ class GlyphSet(_UFOBaseIO):
|
||||
"""
|
||||
fileName = self.contents[glyphName]
|
||||
try:
|
||||
return self.fs.getbytes(fileName)
|
||||
return self.fs.readbytes(fileName)
|
||||
except fs.errors.ResourceNotFound:
|
||||
raise GlifLibError(
|
||||
"The file '%s' associated with glyph '%s' in contents.plist "
|
||||
@ -420,7 +420,7 @@ class GlyphSet(_UFOBaseIO):
|
||||
if (
|
||||
self._havePreviousFile
|
||||
and self.fs.exists(fileName)
|
||||
and data == self.fs.getbytes(fileName)
|
||||
and data == self.fs.readbytes(fileName)
|
||||
):
|
||||
return
|
||||
self.fs.setbytes(fileName, data)
|
||||
|
@ -6,4 +6,4 @@ unicodedata2==11.0.0; python_version < '3.7' and platform_python_implementation
|
||||
scipy==1.2.0; platform_python_implementation != "PyPy"
|
||||
munkres==1.0.12; platform_python_implementation == "PyPy"
|
||||
zopfli==0.1.6
|
||||
fs==2.1.3
|
||||
fs==2.2.1
|
||||
|
2
setup.py
2
setup.py
@ -31,7 +31,7 @@ bumpversion = ['bump2version'] if needs_bumpversion else []
|
||||
extras_require = {
|
||||
# for fontTools.ufoLib: to read/write UFO fonts
|
||||
"ufo": [
|
||||
"fs >= 2.1.1, < 3",
|
||||
"fs >= 2.2.0, < 3",
|
||||
"enum34 >= 1.1.6; python_version < '3.4'",
|
||||
],
|
||||
# for fontTools.misc.etree and fontTools.misc.plistlib: use lxml to
|
||||
|
Loading…
x
Reference in New Issue
Block a user