__save_ebuild_env: filter __repo_key
[portage.git] / bin / binhost-snapshot
index 825a1167221f5b7326db9ee0c600487715700359..e9bd45a2fe866728afb8891884550a0f91656950 100755 (executable)
@@ -1,8 +1,8 @@
 #!/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
@@ -13,13 +13,11 @@ try:
 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])
@@ -109,7 +107,7 @@ def main(argv):
        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')