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"
|
"the data is not properly formatted: %s"
|
||||||
% (fileName, self.fs, e)
|
% (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
|
return
|
||||||
self.fs.setbytes(fileName, data)
|
self.fs.setbytes(fileName, data)
|
||||||
else:
|
else:
|
||||||
@ -356,7 +356,7 @@ class UFOReader(_UFOBaseIO):
|
|||||||
Returns None if the file does not exist.
|
Returns None if the file does not exist.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
return self.fs.getbytes(fsdecode(path))
|
return self.fs.readbytes(fsdecode(path))
|
||||||
except fs.errors.ResourceNotFound:
|
except fs.errors.ResourceNotFound:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -758,7 +758,7 @@ class UFOReader(_UFOBaseIO):
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
# in case readData is called before getDataDirectoryListing
|
# in case readData is called before getDataDirectoryListing
|
||||||
dataFS = self.fs.opendir(DATA_DIRNAME)
|
dataFS = self.fs.opendir(DATA_DIRNAME)
|
||||||
data = dataFS.getbytes(fileName)
|
data = dataFS.readbytes(fileName)
|
||||||
except fs.errors.ResourceNotFound:
|
except fs.errors.ResourceNotFound:
|
||||||
raise UFOLibError("No data file named '%s' on %s" % (fileName, self.fs))
|
raise UFOLibError("No data file named '%s' on %s" % (fileName, self.fs))
|
||||||
return data
|
return data
|
||||||
@ -781,7 +781,7 @@ class UFOReader(_UFOBaseIO):
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
# in case readImage is called before getImageDirectoryListing
|
# in case readImage is called before getImageDirectoryListing
|
||||||
imagesFS = self.fs.opendir(IMAGES_DIRNAME)
|
imagesFS = self.fs.opendir(IMAGES_DIRNAME)
|
||||||
data = imagesFS.getbytes(fileName)
|
data = imagesFS.readbytes(fileName)
|
||||||
except fs.errors.ResourceNotFound:
|
except fs.errors.ResourceNotFound:
|
||||||
raise UFOLibError("No image file named '%s' on %s" % (fileName, self.fs))
|
raise UFOLibError("No image file named '%s' on %s" % (fileName, self.fs))
|
||||||
if validate:
|
if validate:
|
||||||
@ -1006,7 +1006,7 @@ class UFOWriter(UFOReader):
|
|||||||
"""
|
"""
|
||||||
path = fsdecode(path)
|
path = fsdecode(path)
|
||||||
if self._havePreviousFile:
|
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
|
return
|
||||||
try:
|
try:
|
||||||
self.fs.setbytes(path, data)
|
self.fs.setbytes(path, data)
|
||||||
|
@ -290,7 +290,7 @@ class GlyphSet(_UFOBaseIO):
|
|||||||
"""
|
"""
|
||||||
fileName = self.contents[glyphName]
|
fileName = self.contents[glyphName]
|
||||||
try:
|
try:
|
||||||
return self.fs.getbytes(fileName)
|
return self.fs.readbytes(fileName)
|
||||||
except fs.errors.ResourceNotFound:
|
except fs.errors.ResourceNotFound:
|
||||||
raise GlifLibError(
|
raise GlifLibError(
|
||||||
"The file '%s' associated with glyph '%s' in contents.plist "
|
"The file '%s' associated with glyph '%s' in contents.plist "
|
||||||
@ -420,7 +420,7 @@ class GlyphSet(_UFOBaseIO):
|
|||||||
if (
|
if (
|
||||||
self._havePreviousFile
|
self._havePreviousFile
|
||||||
and self.fs.exists(fileName)
|
and self.fs.exists(fileName)
|
||||||
and data == self.fs.getbytes(fileName)
|
and data == self.fs.readbytes(fileName)
|
||||||
):
|
):
|
||||||
return
|
return
|
||||||
self.fs.setbytes(fileName, data)
|
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"
|
scipy==1.2.0; platform_python_implementation != "PyPy"
|
||||||
munkres==1.0.12; platform_python_implementation == "PyPy"
|
munkres==1.0.12; platform_python_implementation == "PyPy"
|
||||||
zopfli==0.1.6
|
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 = {
|
extras_require = {
|
||||||
# for fontTools.ufoLib: to read/write UFO fonts
|
# for fontTools.ufoLib: to read/write UFO fonts
|
||||||
"ufo": [
|
"ufo": [
|
||||||
"fs >= 2.1.1, < 3",
|
"fs >= 2.2.0, < 3",
|
||||||
"enum34 >= 1.1.6; python_version < '3.4'",
|
"enum34 >= 1.1.6; python_version < '3.4'",
|
||||||
],
|
],
|
||||||
# for fontTools.misc.etree and fontTools.misc.plistlib: use lxml to
|
# for fontTools.misc.etree and fontTools.misc.plistlib: use lxml to
|
||||||
|
Loading…
x
Reference in New Issue
Block a user