Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/issue_620'
Browse files Browse the repository at this point in the history
  • Loading branch information
DamnWidget committed Mar 17, 2017
2 parents 4230911 + a05e091 commit 5bd283a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
8 changes: 4 additions & 4 deletions anaconda_lib/workers/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,18 @@ def __extract_port(self, view):
"""Extract the port to connect to
"""

if sublime.platform() == 'windows':
if sublime.platform() != 'linux':
self.__data['host'] = 'localhost'
else:
self.__data['host'] = self.__get_unix_domain_socket()
return

if debug_enabled(view):
port = get_settings(view, 'jsonserver_debug_port', 999)
port = get_settings(view, 'jsonserver_debug_port', 9999)
self.__data['port'] = port
return

if sublime.platform() == 'windows':
if sublime.platform() != 'linux':
s = socket.socket()
s.bind(('', 0))
self.__data['port'] = s.getsockname()[1]
Expand Down Expand Up @@ -173,7 +173,7 @@ def __get_unix_domain_socket(self):
"""Compound the Unix domain socket path
"""

if sublime.platform() == 'windows':
if sublime.platform() != 'linux':
return 'localhost'

return UnixSocketPath(self.project_name).socket
Expand Down
2 changes: 1 addition & 1 deletion anaconda_lib/workers/local_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def _status(self, timeout=0.05):

check = 'that you can connect to your localhost'
addr = '("localhost", {})'.format(self.interpreter.port)
if sublime.platform() != 'windows':
if sublime.platform() == 'linux':
check = (
'that the Unix Domain Socket file {} exists and that you can '
'connect to it'
Expand Down
2 changes: 1 addition & 1 deletion anaconda_lib/workers/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def unix_socket(self):
"""

for_local = self.interpreter.for_local
return for_local and sublime.platform() != 'windows'
return for_local and sublime.platform() == 'linux'

def start(self):
"""Start the worker
Expand Down
8 changes: 5 additions & 3 deletions anaconda_server/jsonserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import time
import socket
import logging
import platform
import asyncore
import asynchat
import threading
Expand Down Expand Up @@ -137,7 +138,7 @@ class JSONServer(asyncore.dispatcher):

allow_reuse_address = False
request_queue_size = 5
if os.name == 'nt':
if platform.system().lower() != 'linux':
address_family = socket.AF_INET
else:
address_family = socket.AF_UNIX
Expand Down Expand Up @@ -287,6 +288,7 @@ def log_traceback():
if __name__ == "__main__":

WINDOWS = os.name == 'nt'
LINUX = platform.system().lower() == 'linux'
opt_parser = OptionParser(usage=(
'usage: %prog -p <project> -e <extra_paths> port'
)) if WINDOWS else OptionParser(usage=(
Expand All @@ -304,7 +306,7 @@ def log_traceback():

options, args = opt_parser.parse_args()
port, PID = None, None
if WINDOWS:
if not LINUX:
if len(args) != 2:
opt_parser.error('you have to pass a port number and PID')

Expand Down Expand Up @@ -333,7 +335,7 @@ def log_traceback():
logger = get_logger(log_directory)

try:
if WINDOWS:
if not LINUX:
server = JSONServer(('localhost', port))
else:
unix_socket_path = UnixSocketPath(options.project)
Expand Down

0 comments on commit 5bd283a

Please sign in to comment.