# protocols and requires the base url to have a trailing
# slash, so join manually...
f = urllib_request_urlopen(base_url.rstrip("/") + "/Packages")
+ f_dec = codecs.iterdecode(f,
+ _encodings['repo.content'], errors='replace')
try:
- rmt_idx.readHeader(f)
+ rmt_idx.readHeader(f_dec)
remote_timestamp = rmt_idx.header.get("TIMESTAMP", None)
if not remote_timestamp:
# no timestamp in the header, something's wrong
rmt_idx.header.get("VERSION"), noiselevel=-1)
pkgindex = None
elif local_timestamp != remote_timestamp:
- rmt_idx.readBody(f)
+ rmt_idx.readBody(f_dec)
pkgindex = rmt_idx
finally:
f.close()
from portage.util import atomic_ofstream, ensure_dirs
ensure_dirs(os.path.dirname(pkgindex_file))
f = atomic_ofstream(pkgindex_file)
- try:
- pkgindex.write(f)
- finally:
- f.close()
+ pkgindex.write(f)
+ f.close()
if pkgindex:
self._remotepkgs = {}
for d in pkgindex.packages: