Skip to content

Commit 94a7041

Browse files
committed
More fixes for UTF-8 characters in manifests files
1 parent 900da3c commit 94a7041

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/modules/client/transport/transport.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,7 +1686,7 @@ def _prefetch_manifests_list(self, mxfr, mlist, excludes=misc.EmptyI):
16861686
continue
16871687

16881688
try:
1689-
mf = open(dl_path)
1689+
mf = open(dl_path, "r", encoding="UTF-8")
16901690
mcontent = mf.read()
16911691
mf.close()
16921692
manifest.FactoredManifest(fmri,
@@ -1776,7 +1776,7 @@ def _verify_manifest(self, fmri, mfstpath=None, content=None, pub=None):
17761776
return False
17771777

17781778
if mfstpath:
1779-
mf = open(mfstpath)
1779+
mf = open(mfstpath, "r", encoding="UTF-8")
17801780
mcontent = mf.read()
17811781
mf.close()
17821782
elif content is not None:

src/modules/manifest.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,7 @@ def search_dict(file_path, excludes, return_line=False,
12291229
log = lambda x: None
12301230

12311231
try:
1232-
file_handle = open(file_path, "r")
1232+
file_handle = open(file_path, "r", encoding="UTF-8")
12331233
except EnvironmentError as e:
12341234
if e.errno != errno.ENOENT:
12351235
raise
@@ -1364,7 +1364,7 @@ def store(self, mfst_path):
13641364
e.filename)
13651365
raise
13661366

1367-
mfile = os.fdopen(fd, "w")
1367+
mfile = os.fdopen(fd, "w", encoding="UTF-8")
13681368

13691369
#
13701370
# We specifically avoid sorting manifests before writing
@@ -1668,7 +1668,7 @@ def __storebytype(self):
16681668
except EnvironmentError as e:
16691669
raise apx._convert_error(e)
16701670

1671-
f = os.fdopen(fd, "w")
1671+
f = os.fdopen(fd, "w", encoding="UTF-8")
16721672
try:
16731673
for a in acts:
16741674
f.write("{0}\n".format(a))
@@ -1695,7 +1695,7 @@ def create_cache(name, refs):
16951695
try:
16961696
fd, fn = tempfile.mkstemp(dir=t_dir,
16971697
prefix=name + ".")
1698-
with os.fdopen(fd, "w") as f:
1698+
with os.fdopen(fd, "w", encoding="UTF-8") as f:
16991699
f.writelines(refs())
17001700
os.chmod(fn, PKG_FILE_MODE)
17011701
portable.rename(fn, self.__cache_path(name))
@@ -1745,7 +1745,7 @@ def __load_cached_data(self, name):
17451745
if os.path.exists(mpath):
17461746
# we have cached copy on disk; use it
17471747
try:
1748-
with open(mpath, "r") as f:
1748+
with open(mpath, "r", encoding="UTF-8") as f:
17491749
self._cache[name] = [
17501750
a for a in
17511751
(
@@ -1830,7 +1830,7 @@ def gen_actions_by_type(self, atype, attr_match=None, excludes=EmptyI):
18301830
attr_match = _compile_fnpats(attr_match)
18311831

18321832
try:
1833-
with open(mpath, "r") as f:
1833+
with open(mpath, "r", encoding="UTF-8") as f:
18341834
for l in f:
18351835
a = actions.fromstr(l.rstrip())
18361836
if (excludes and
@@ -1889,7 +1889,7 @@ def __load_attributes(self):
18891889
mpath = self.__cache_path("manifest.set")
18901890
if not os.path.exists(mpath):
18911891
return False
1892-
with open(mpath, "r") as f:
1892+
with open(mpath, "r", encoding="UTF-8") as f:
18931893
for l in f:
18941894
a = actions.fromstr(l.rstrip())
18951895
if not self.excludes or \

0 commit comments

Comments
 (0)