opts, pargs = parser.parse_args(args=sys.argv[1:])
- os.environ["PORTAGE_CALLER"]="ebuild"
-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
+# for an explanation on this logic, see pym/_emerge/__init__.py
+from os import environ as ose
+from os import path as osp
+if ose.__contains__("PORTAGE_PYTHONPATH"):
+ sys.path.insert(0, ose["PORTAGE_PYTHONPATH"])
+else:
- sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp. realpath(__file__))), "pym"))
++ sys.path.insert(0, osp.join(osp.dirname(osp.dirname(osp.realpath(__file__))), "pym"))
+import portage
portage.dep._internal_warnings = True
from portage import os
-#!/usr/bin/python
+#!@PREFIX_PORTAGE_PYTHON@
- # Copyright 1999-2006 Gentoo Foundation
+ # Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import print_function
- import os,sys
- os.environ["PORTAGE_CALLER"]="fixpackages"
+ import os
+ import sys
+
-try:
- import portage
-except ImportError:
- from os import path as osp
++# for an explanation on this logic, see pym/_emerge/__init__.py
++from os import environ as ose
++from os import path as osp
++if ose.__contains__("PORTAGE_PYTHONPATH"):
++ sys.path.insert(0, ose["PORTAGE_PYTHONPATH"])
++else:
+ 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 EOutput
from portage.output import ConsoleStyleFile, StyleWriter
from portage.util import cmp_sort_key, writemsg_level, writemsg_stdout
from portage.package.ebuild.digestgen import digestgen
- from portage.eapi import eapi_has_slot_deps, \
- eapi_has_use_deps, eapi_has_strong_blocks, eapi_has_iuse_defaults, \
- eapi_has_required_use, eapi_has_use_dep_defaults
+ from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use
+from portage.const import EPREFIX
if sys.hexversion >= 0x3000000:
basestring = str