Merge pull request #284 from dw/issue277

issue #277: core: move Darwin versioner check into first stage
pull/292/head
dw 6 years ago committed by GitHub
commit 0cb9335cde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -686,11 +686,6 @@ class Stream(mitogen.core.Stream):
self.max_message_size = max_message_size
if python_path:
self.python_path = python_path
if sys.platform == 'darwin' and self.python_path == '/usr/bin/python':
# OS X installs a craptacular argv0-introspecting Python version
# switcher as /usr/bin/python. Override attempts to call it with an
# explicit call to python2.7
self.python_path = '/usr/bin/python2.7'
if connect_timeout:
self.connect_timeout = connect_timeout
if remote_name is None:
@ -775,6 +770,9 @@ class Stream(mitogen.core.Stream):
# substituted with their respective values.
# * CONTEXT_NAME must be prefixed with the name of the Python binary in
# order to allow virtualenvs to detect their install prefix.
# * For Darwin, OS X installs a craptacular argv0-introspecting Python
# version switcher as /usr/bin/python. Override attempts to call it
# with an explicit call to python2.7
@staticmethod
def _first_stage():
R,W=os.pipe()
@ -787,6 +785,8 @@ class Stream(mitogen.core.Stream):
os.close(r)
os.close(W)
os.close(w)
if sys.platform == 'darwin' and sys.executable == '/usr/bin/python':
sys.executable += sys.version[:3]
os.environ['ARGV0']=sys.executable
os.execl(sys.executable,sys.executable+'(mitogen:CONTEXT_NAME)')
os.write(1,'EC0\n')

@ -91,7 +91,6 @@ class HostKeyError(mitogen.core.StreamError):
class Stream(mitogen.parent.Stream):
create_child = staticmethod(mitogen.parent.hybrid_tty_create_child)
child_is_immediate_subprocess = False
python_path = 'python2.7'
#: Number of -v invocations to pass on command line.
ssh_debug_level = 0

Loading…
Cancel
Save