_unicode_encode() and _unicode_decode() where appropriate.
svn path=/main/trunk/; revision=13995
import commands
import errno
import logging
-import os
import platform
import pwd
import re
import time
from itertools import chain, 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 import digraph
from portage.cache.cache_errors import CacheError
from portage.const import NEWS_LIB_PATH
# $Id$
import codecs
-import os
import re
-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
def calc_changelog(ebuildpath,current,next):
if ebuildpath == None or not os.path.exists(ebuildpath):
next = next[:-3]
changelogpath = os.path.join(os.path.split(ebuildpath)[0],'ChangeLog')
try:
- changelog = codecs.open(changelogpath, mode='r',
- encoding='utf_8', errors='replace').read()
+ changelog = codecs.open(portage._unicode_encode(changelogpath),
+ mode='r', encoding='utf_8', errors='replace').read()
except SystemExit, e:
raise # Needed else can't exit
except:
# $Id$
import gc
-
-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
def clear_caches(trees):
for d in trees.itervalues():
# 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
def create_world_atom(pkg, args_set, root_config):
"""Create a new atom for the world file if one does not exist. If the
# $Id$
import gc
-import os
import re
import sys
import textwrap
from itertools import chain, 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 import digraph
from portage.output import bold, blue, colorize, create_color_func, darkblue, \
darkgreen, green, nc_len, red, teal, turquoise, yellow
# $Id$
import codecs
-import os
import sys
import time
-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.data import secpass
from portage.output import xtermTitle
-
+
_emerge_log_dir = '/var/log'
def emergelog(xterm_titles, mystr, short_msg=None):
- if not isinstance(mystr, unicode):
- mystr = unicode(mystr, encoding='utf_8', errors='replace')
+ mystr = portage._unicode_decode(mystr)
- if short_msg is not None and not isinstance(short_msg, unicode):
- short_msg = unicode(short_msg, encoding='utf_8', errors='replace')
+ if short_msg is not None:
+ short_msg = portage._unicode_decode(short_msg)
if xterm_titles and short_msg:
if "HOSTNAME" in os.environ:
xtermTitle(short_msg)
try:
file_path = os.path.join(_emerge_log_dir, 'emerge.log')
- mylogfile = codecs.open(file_path, mode='a',
+ mylogfile = codecs.open(portage._unicode_encode(file_path), mode='a',
encoding='utf_8', errors='replace')
portage.util.apply_secpass_permissions(file_path,
uid=portage.portage_uid, gid=portage.portage_gid,
# Distributed under the terms of the GNU General Public License v2
# $Id$
-import os
+from portage import os
getloadavg = getattr(os, "getloadavg", None)
if getloadavg is None:
# $Id$
import re
-
-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
def is_valid_package_atom(x):
if "/" not in x:
import signal
import sys
import textwrap
-import os
import platform
-
-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
import _emerge.help
import portage.xpak, commands, errno, re, time
from portage.output import colorize, xtermTitle, xtermTitleReset
if myargs and not isinstance(myargs[0], unicode):
for i in xrange(len(myargs)):
- myargs[i] = unicode(myargs[i], encoding='utf_8', errors='replace')
+ myargs[i] = portage._unicode_decode(myargs[i])
myfiles += myargs
# Distributed under the terms of the GNU General Public License v2
# $Id$
-import os
import re
from itertools import izip
-
-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 portage.output import bold, bold as white, darkgreen, green, red
from portage.util import writemsg_stdout
# $Id$
import logging
-import os
import textwrap
-
-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 portage.util import writemsg_level
def show_invalid_depstring_notice(parent_node, depstring, error_msg):
# $Id$
import logging
-import os
import sys
import textwrap
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.output import bold, colorize, darkgreen, green
from portage.sets import SETPREFIX
from portage.util import cmp_sort_key
# 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
def visible(pkgsettings, pkg):
"""