#!/usr/bin/python
-# Copyright 2010 Gentoo Foundation
+# Copyright 2010-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-import codecs
+import io
import optparse
import os
import sys
except ImportError:
from urlparse import urlparse
-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
+from os import path as osp
+pym_path = osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym")
+sys.path.insert(0, pym_path)
+import portage
+portage._internal_caller = True
def parse_args(argv):
prog_name = os.path.basename(argv[0])
if not (os.WIFEXITED(ret) and os.WEXITSTATUS(ret) == os.EX_OK):
return 1
- infile = codecs.open(portage._unicode_encode(src_pkgs_index,
+ infile = io.open(portage._unicode_encode(src_pkgs_index,
encoding=portage._encodings['fs'], errors='strict'),
mode='r', encoding=portage._encodings['repo.content'],
errors='strict')