From ffab1b470ccb18f9b74daaa3134df017ca205980 Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Wed, 14 Jul 2010 12:47:41 -0300 Subject: a lot of fixes. looks like g-octave already works with py3k --- g_octave/compat.py | 4 ++-- g_octave/ebuild.py | 3 ++- g_octave/overlay.py | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/g_octave/compat.py b/g_octave/compat.py index fe83415..8c93f6f 100644 --- a/g_octave/compat.py +++ b/g_octave/compat.py @@ -13,7 +13,7 @@ __all__ = [ 'py3k', - 'open', + 'open_py3k', ] import codecs @@ -23,7 +23,7 @@ py3k = sys.version_info >= (3, 0) #open = py3k and open or codecs.open -def open(filename, mode, **kwargs): +def open_py3k(filename, mode, **kwargs): if 'encoding' not in kwargs: kwargs['encoding'] = 'utf-8' if py3k: diff --git a/g_octave/ebuild.py b/g_octave/ebuild.py index b7aee0d..253cfc1 100644 --- a/g_octave/ebuild.py +++ b/g_octave/ebuild.py @@ -22,7 +22,6 @@ from .config import Config from .description import * from .description_tree import * from .exception import EbuildException -from .compat import open has_svn = True try: @@ -38,6 +37,8 @@ import re import shutil import subprocess +from codecs import open + out = portage.output.EOutput() # validating keywords (based on the keywords from the sci-mathematics/octave package) diff --git a/g_octave/overlay.py b/g_octave/overlay.py index 7c1a834..ec32965 100644 --- a/g_octave/overlay.py +++ b/g_octave/overlay.py @@ -20,9 +20,10 @@ import sys import shutil import portage.output +from codecs import open + from .config import Config from .exception import ConfigException -from .compat import open out = portage.output.EOutput() @@ -72,7 +73,7 @@ def create_overlay(force=False, conf=None, quiet=False): if not os.path.exists(_file) or force: with open(_file, 'w') as fp: content = files[_file] - if isinstance(content, file): + if hasattr(content, 'name'): content = content.read() fp.write(content) except Exception as error: -- cgit v1.2.3-65-gdbad