aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2012-03-22 14:36:36 -0700
committerZac Medico <zmedico@gentoo.org>2012-03-22 14:36:36 -0700
commit7c4c48d9a4344a6f1c9859ae178ed78408ba2777 (patch)
tree97219b12c4899ebc815d68a47dce9c3b39b29e20 /pym/portage/util
parentemerge --changelog: show some log entries above (diff)
downloadportage-7c4c48d9a4344a6f1c9859ae178ed78408ba2777.tar.gz
portage-7c4c48d9a4344a6f1c9859ae178ed78408ba2777.tar.bz2
portage-7c4c48d9a4344a6f1c9859ae178ed78408ba2777.zip
mtimedb: enable JSON write supportv2.2.0_alpha94
JSON read support has been available since portage-2.1.10.49.
Diffstat (limited to 'pym/portage/util')
-rw-r--r--pym/portage/util/mtimedb.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/pym/portage/util/mtimedb.py b/pym/portage/util/mtimedb.py
index 4ccea2438..736e314d5 100644
--- a/pym/portage/util/mtimedb.py
+++ b/pym/portage/util/mtimedb.py
@@ -24,8 +24,8 @@ from portage.util import apply_secpass_permissions, atomic_ofstream, writemsg
class MtimeDB(dict):
- # Enable this after JSON read has been supported for some time.
- _json_write = False
+ # JSON read support has been available since portage-2.1.10.49.
+ _json_write = True
_json_write_opts = {
"ensure_ascii": False,
@@ -60,19 +60,19 @@ class MtimeDB(dict):
d = None
if content:
try:
- mypickle = pickle.Unpickler(io.BytesIO(content))
- try:
- mypickle.find_global = None
- except AttributeError:
- # TODO: If py3k, override Unpickler.find_class().
- pass
- d = mypickle.load()
+ d = json.loads(_unicode_decode(content,
+ encoding=_encodings['repo.content'], errors='strict'))
except SystemExit:
raise
except Exception as e:
try:
- d = json.loads(_unicode_decode(content,
- encoding=_encodings['repo.content'], errors='strict'))
+ mypickle = pickle.Unpickler(io.BytesIO(content))
+ try:
+ mypickle.find_global = None
+ except AttributeError:
+ # Python >=3
+ pass
+ d = mypickle.load()
except SystemExit:
raise
except Exception: