diff options
author | dol-sen <brian.dolbec@gmail.com> | 2011-10-26 16:19:06 -0700 |
---|---|---|
committer | dol-sen <brian.dolbec@gmail.com> | 2011-10-26 16:19:06 -0700 |
commit | c40874bd95d1525961692dd7d742ed565a2b4334 (patch) | |
tree | d774c213a57cb2ed06d74d664a86ccbad4bf4a5b /layman | |
parent | 9a74747e60f08a6f303d36d45ad9bb2ba828af42 (diff) | |
parent | bce27850d7e2d86e1b8046be8eb1d51c83dbdd2c (diff) | |
download | layman-c40874bd95d1525961692dd7d742ed565a2b4334.tar.gz layman-c40874bd95d1525961692dd7d742ed565a2b4334.tar.bz2 layman-c40874bd95d1525961692dd7d742ed565a2b4334.zip |
Merge branch 'master' of git+ssh://git.overlays.gentoo.org/proj/layman
Diffstat (limited to 'layman')
-rw-r--r-- | layman/db.py | 6 | ||||
-rw-r--r-- | layman/overlays/tar.py | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/layman/db.py b/layman/db.py index cca257b..0215a2f 100644 --- a/layman/db.py +++ b/layman/db.py @@ -27,6 +27,7 @@ __version__ = "$Id: db.py 309 2007-04-09 16:23:38Z wrobel $" #------------------------------------------------------------------------------- import os, os.path +import sys import urllib2 import hashlib @@ -414,11 +415,12 @@ class RemoteDB(DbBase): 'oblem with the webserver. Check the content ' 'of the file. Error was:\n' + str(error)) + # the folowing is neded for py3 only + if sys.hexversion >= 0x3000000 and hasattr(olist, 'decode'): + olist = olist.decode("UTF-8") # Ok, now we can overwrite the old cache try: out_file = fileopen(mpath, 'w') - if hasattr(olist, 'decode'): - olist = olist.decode("UTF-8") out_file.write(olist) out_file.close() diff --git a/layman/overlays/tar.py b/layman/overlays/tar.py index 5d66acc..c6f2443 100644 --- a/layman/overlays/tar.py +++ b/layman/overlays/tar.py @@ -118,7 +118,7 @@ class TarOverlay(OverlaySource): pkg = path([base, self.parent.name + ext]) try: - out_file = open(pkg, 'w') + out_file = open(pkg, 'w+b') out_file.write(tar) out_file.close() except Exception, error: |