_unicode_encode() and _unicode_decode() where appropriate.
svn path=/main/trunk/; revision=13994
import re
from itertools import chain
-
-try:
- import portage
-except ImportError:
- from os import path as osp
- import sys
- sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
- import portage
-
+import portage
from portage.cache.mappings import slot_dict_class
from portage.dep import paren_reduce, use_reduce, \
paren_normalize, paren_enclose
# $Id$
from _emerge.DependencyArg import DependencyArg
-try:
- import portage
-except ImportError:
- from os import path as osp
- import sys
- sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
- import portage
+import portage
+
class PackageArg(DependencyArg):
def __init__(self, package=None, **kwargs):
DependencyArg.__init__(self, **kwargs)
self.package = package
self.atom = portage.dep.Atom("=" + package.cpv)
self.set = (self.atom, )
-
import codecs
import logging
-import os
-
-try:
- import portage
-except ImportError:
- from os import path as osp
- import sys
- sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
- import portage
-
+import portage
+from portage import os
from _emerge.AsynchronousTask import AsynchronousTask
from _emerge.unmerge import unmerge
from _emerge.UninstallFailure import UninstallFailure
# Distributed under the terms of the GNU General Public License v2
# $Id$
-try:
- import portage
-except ImportError:
- from os import path as osp
- import sys
- sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
- import portage
+import portage
+
class PackageVirtualDbapi(portage.dbapi):
"""
A dbapi-like interface class that represents the state of the installed
# Distributed under the terms of the GNU General Public License v2
# $Id$
+from portage import os
from _emerge.AbstractPollTask import AbstractPollTask
from _emerge.PollConstants import PollConstants
import sys
-import os
import fcntl
import array
+
class PipeReader(AbstractPollTask):
"""
# $Id$
from portage.output import teal
-import os
+from portage import os
+
class RepoDisplay(object):
def __init__(self, roots):
self._shown_repos = {}
import codecs
import logging
-import os
import sys
import textwrap
import time
import weakref
from itertools import izip
-
-try:
- import portage
-except ImportError:
- from os import path as osp
- sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
- import portage
-
+import portage
+from portage import os
from portage.cache.mappings import slot_dict_class
from portage.elog.messages import eerror
from portage.output import colorize, create_color_func, darkgreen, red
def _append_to_log_path(self, log_path, msg):
- if not isinstance(msg, unicode):
- msg = unicode(msg, encoding='utf_8', errors='replace')
-
- f = codecs.open(log_path, mode='a',
+ f = codecs.open(portage._unicode_encode(log_path), mode='a',
encoding='utf_8', errors='replace')
try:
- f.write(msg)
+ f.write(portage._unicode_decode(msg))
finally:
f.close()
background = self._background
if background and log_path is not None:
- log_file = codecs.open(log_path, mode='a',
+ log_file = codecs.open(portage._unicode_encode(log_path), mode='a',
encoding='utf_8', errors='replace')
out = log_file
log_path = self._locate_failure_log(failed_pkg)
if log_path is not None:
try:
- log_file = codecs.open(log_path, mode='r',
- encoding='utf_8', errors='replace')
+ log_file = codecs.open(portage._unicode_encode(log_path),
+ mode='r', encoding='utf_8', errors='replace')
except IOError:
pass
from _emerge.PollConstants import PollConstants
import sys
from portage.cache.mappings import slot_dict_class
-try:
- import portage
-except ImportError:
- from os import path as osp
- import sys
- sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
- import portage
-import os
+import portage
+from portage import os
import fcntl
import errno
import array
+
class SpawnProcess(SubProcess):
"""
# Distributed under the terms of the GNU General Public License v2
# $Id$
+from portage import os
from _emerge.AbstractPollTask import AbstractPollTask
import signal
-import os
import errno
+
class SubProcess(AbstractPollTask):
__slots__ = ("pid",) + \
# Distributed under the terms of the GNU General Public License v2
# $Id$
+from portage import os
from _emerge.CompositeTask import CompositeTask
from _emerge.AsynchronousTask import AsynchronousTask
-import os
from collections import deque
+
class TaskSequence(CompositeTask):
"""
A collection of tasks that executes sequentially. Each task
# Distributed under the terms of the GNU General Public License v2
# $Id$
-try:
- import portage
-except ImportError:
- from os import path as osp
- import sys
- sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
- import portage
-
+import portage
+
class UninstallFailure(portage.exception.PortageException):
"""
An instance of this class is raised by unmerge() when