aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'pym/gentoolkit/revdep_rebuild/cache.py')
-rw-r--r--pym/gentoolkit/revdep_rebuild/cache.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/pym/gentoolkit/revdep_rebuild/cache.py b/pym/gentoolkit/revdep_rebuild/cache.py
index 3d925d8..31ee2c9 100644
--- a/pym/gentoolkit/revdep_rebuild/cache.py
+++ b/pym/gentoolkit/revdep_rebuild/cache.py
@@ -8,6 +8,7 @@ from __future__ import print_function
import os
import time
+from portage import _encodings, _unicode_decode, _unicode_encode
from portage.output import red
from .settings import DEFAULTS
@@ -29,7 +30,8 @@ def read_cache(temp_path=DEFAULTS['DEFAULT_TMP_DIR']):
}
try:
for key,val in ret.items():
- _file = open(os.path.join(temp_path, key))
+ _file = open(_unicode_encode(os.path.join(temp_path, key)),
+ encoding=_encodings['fs'])
for line in _file.readlines():
val.add(line.strip())
#libraries.remove('\n')
@@ -52,12 +54,14 @@ def save_cache(logger, to_save={}, temp_path=DEFAULTS['DEFAULT_TMP_DIR']):
os.makedirs(temp_path)
try:
- _file = open(os.path.join(temp_path, 'timestamp'), 'w')
+ _file = open(_unicode_encode(os.path.join(temp_path, 'timestamp')),
+ encoding=_encodings['fs'], mode='w')
_file.write(str(int(time.time())))
_file.close()
for key,val in to_save.items():
- _file = open(os.path.join(temp_path, key), 'w')
+ _file = open(_unicode_encode(os.path.join(temp_path, key)),
+ encoding=_encodings['fs'], mode='w')
for line in val:
_file.write(line + '\n')
_file.close()
@@ -85,7 +89,7 @@ def check_temp_files(temp_path=DEFAULTS['DEFAULT_TMP_DIR'], max_delay=3600,
return False
try:
- _file = open(timestamp_path)
+ _file = open(_unicode_encode(timestamp_path), encoding=_encodings['fs'])
timestamp = int(_file.readline())
_file .close()
except Exception as ex: