chpathtool.py: portage.util._argparse
authorZac Medico <zmedico@gentoo.org>
Sat, 3 Aug 2013 00:35:15 +0000 (17:35 -0700)
committerZac Medico <zmedico@gentoo.org>
Sat, 3 Aug 2013 00:37:11 +0000 (17:37 -0700)
bin/chpathtool.py
pym/_emerge/Binpkg.py

index a040babfb03a6944e25ef9687e5e0a10bdc7f43b..c35acd1459c0187308603cb4e1d4681e1593897c 100755 (executable)
@@ -3,11 +3,12 @@
 # Distributed under the terms of the GNU General Public License v2
 
 import io
-import optparse
 import os
 import stat
 import sys
 
+from portage.util._argparse import ArgumentParser
+
 CONTENT_ENCODING = "utf_8"
 FS_ENCODING = "utf_8"
 
@@ -142,8 +143,8 @@ def chpath_inplace_symlink(filename, st, old, new):
 def main(argv):
 
        usage = "%s [options] <location> <old> <new>" % (os.path.basename(argv[0],))
-       parser = optparse.OptionParser(usage=usage)
-       options, args = parser.parse_args(argv[1:])
+       parser = ArgumentParser(usage=usage)
+       options, args = parser.parse_known_args(argv[1:])
 
        if len(args) != 3:
                parser.error("3 args required, got %s" % (len(args),))
index ea8a1ad13a0da2fb98f43e4b1e1635a9d38c615e..36f851609f78c1db50e465eeaec2ef3db06a63ab 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 from _emerge.EbuildPhase import EbuildPhase
@@ -328,11 +328,13 @@ class Binpkg(CompositeTask):
                        self.wait()
                        return
 
+               env = self.settings.environ()
+               env["PYTHONPATH"] = self.settings["PORTAGE_PYTHONPATH"]
                chpathtool = SpawnProcess(
                        args=[portage._python_interpreter,
                        os.path.join(self.settings["PORTAGE_BIN_PATH"], "chpathtool.py"),
                        self.settings["D"], self._build_prefix, self.settings["EPREFIX"]],
-                       background=self.background, env=self.settings.environ(), 
+                       background=self.background, env=env,
                        scheduler=self.scheduler,
                        logfile=self.settings.get('PORTAGE_LOG_FILE'))
                self._writemsg_level(">>> Adjusting Prefix to %s\n" % self.settings["EPREFIX"])