From: Zac Medico Date: Sun, 22 Mar 2009 22:05:47 +0000 (-0000) Subject: Inside spawn(), avoid redundant os.access() and stat() calls on commonly X-Git-Tag: v2.2_rc27~12 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a701b884a9ec299351d431cbfaa68b858d9158d0;p=portage.git Inside spawn(), avoid redundant os.access() and stat() calls on commonly spawned binaries such as BASH_BINARY, SANDBOX_BINARY, and FAKEROOT_BINARY. Thanks to Piotr JaroszyƄski for reporting. svn path=/main/trunk/; revision=13144 --- diff --git a/pym/portage/process.py b/pym/portage/process.py index 6f449c3d6..a88f5bf28 100644 --- a/pym/portage/process.py +++ b/pym/portage/process.py @@ -181,7 +181,8 @@ def spawn(mycommand, env={}, opt_name=None, fd_pipes=None, returnpid=False, # If an absolute path to an executable file isn't given # search for it unless we've been told not to. binary = mycommand[0] - if (not os.path.isabs(binary) or not os.path.isfile(binary) + if binary not in (BASH_BINARY, SANDBOX_BINARY, FAKEROOT_BINARY) and \ + (not os.path.isabs(binary) or not os.path.isfile(binary) or not os.access(binary, os.X_OK)): binary = path_lookup and find_binary(binary) or None if not binary: