Add a QueryCommand.settings attribute and use it so that $USE
authorZac Medico <zmedico@gentoo.org>
Sat, 14 Aug 2010 16:20:49 +0000 (09:20 -0700)
committerZac Medico <zmedico@gentoo.org>
Sat, 14 Aug 2010 16:20:49 +0000 (09:20 -0700)
doesn't have to be passed to the daemon in has_version and
best_version calls.

bin/ebuild.sh
pym/_emerge/AbstractEbuildProcess.py
pym/portage/package/ebuild/_ipc/QueryCommand.py

index 18f96b6555cd4309a9c9258359fe7235739091ae..32cda5012ef2e840ee731adcb3a0ea41118b8a6a 100755 (executable)
@@ -160,7 +160,7 @@ has_version() {
        fi
 
        if [[ -n $PORTAGE_IPC_DAEMON ]] ; then
-               "$PORTAGE_BIN_PATH"/ebuild-ipc has_version "$ROOT" "$1" "$USE"
+               "$PORTAGE_BIN_PATH"/ebuild-ipc has_version "$ROOT" "$1"
                return $?
        fi
 
@@ -203,7 +203,7 @@ best_version() {
        fi
 
        if [[ -n $PORTAGE_IPC_DAEMON ]] ; then
-               "$PORTAGE_BIN_PATH"/ebuild-ipc best_version "$ROOT" "$1" "$USE"
+               "$PORTAGE_BIN_PATH"/ebuild-ipc best_version "$ROOT" "$1"
                return $?
        fi
 
index 416babcfbc7259886372fe71e837206405ee12b8..21fd8803874221e7becd4aa3c45d30045c67cd31 100644 (file)
@@ -41,7 +41,7 @@ class AbstractEbuildProcess(SpawnProcess):
                                self.settings['PORTAGE_BUILDDIR'], '.ipc_in')
                        output_fifo = os.path.join(
                                self.settings['PORTAGE_BUILDDIR'], '.ipc_out')
-                       query_command = QueryCommand()
+                       query_command = QueryCommand(self.settings)
                        commands = {
                                'best_version' : query_command,
                                'exit'         : self._exit_command,
index 684837456740fe053d2d125427b57d118e372e53..47095cb4c5e715403ad2be9b921f2f665300340e 100644 (file)
@@ -11,25 +11,26 @@ from portage.versions import best
 
 class QueryCommand(IpcCommand):
 
-       __slots__ = ()
+       __slots__ = ('settings',)
 
        _db = None
 
-       def __init__(self):
+       def __init__(self, settings):
                IpcCommand.__init__(self)
+               self.settings = settings
 
        def __call__(self, argv):
                """
                @returns: tuple of (stdout, stderr, returncode)
                """
-               cmd, root, atom, use = argv
+               cmd, root, atom = argv
 
                try:
                        atom = Atom(atom)
                except InvalidAtom:
                        return ('', 'invalid atom: %s\n' % atom, 2)
 
-               use = frozenset(use.split())
+               use = frozenset(self.settings['PORTAGE_USE'].split())
                atom = atom.evaluate_conditionals(use)
 
                db = self._db