summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/portage/dbapi/vartree.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 5b6f54a6a..a5b39e317 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -4017,7 +4017,10 @@ class dblink(object):
return mydata
def setfile(self,fname,data):
- write_atomic(os.path.join(self.dbdir, fname), data)
+ mode = 'w'
+ if fname == 'environment.bz2' or not isinstance(data, basestring):
+ mode = 'wb'
+ write_atomic(os.path.join(self.dbdir, fname), data, mode=mode)
def getelements(self,ename):
if not os.path.exists(self.dbdir+"/"+ename):