-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
5 changed files
with
42 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf8 -*- | ||
|
||
# Copyright (C) 2013 - Oscar Campos <[email protected]> | ||
|
@@ -16,20 +17,23 @@ | |
import subprocess | ||
from logging import handlers | ||
from optparse import OptionParser | ||
from os import chmod | ||
from os.path import dirname, join, abspath | ||
from operator import xor | ||
|
||
# we use ujson if it's available on the target intrepreter | ||
# we use ujson if it's available on the target interpreter | ||
try: | ||
import ujson as json | ||
except ImportError: | ||
import json | ||
|
||
sys.path.insert(0, os.path.join( | ||
os.path.split(os.path.split(__file__)[0])[0], 'anaconda_lib')) | ||
PROJECT_ROOT = dirname(dirname(abspath(__file__))) | ||
sys.path.insert(0, join(PROJECT_ROOT, 'anaconda_lib')) | ||
|
||
from lib.path import log_directory | ||
from jedi import set_debug_function | ||
from lib.contexts import json_decode | ||
from unix_socket import UnixSocketPath | ||
from unix_socket import UnixSocketPath, get_current_umask | ||
from handlers import ANACONDA_HANDLERS | ||
from jedi import settings as jedi_settings | ||
from lib.anaconda_handler import AnacondaHandler | ||
|
@@ -154,9 +158,10 @@ def __init__(self, address, handler=JSONHandler): | |
self.last_call = time.time() | ||
|
||
self.bind(self.address) | ||
if platform.system().lower() != 'linux': | ||
if hasattr(socket, 'AF_UNIX') and \ | ||
self.address_family == socket.AF_UNIX: | ||
# WSL 1903 fix | ||
os.chmod(self.address, 0o600) | ||
chmod(self.address, xor(0o777, get_current_umask())) | ||
logging.debug('bind: address=%s' % (address,)) | ||
self.listen(self.request_queue_size) | ||
logging.debug('listen: backlog=%d' % (self.request_queue_size,)) | ||
|
@@ -266,7 +271,7 @@ def get_logger(path): | |
log = logging.getLogger('') | ||
log.setLevel(logging.DEBUG) | ||
hdlr = handlers.RotatingFileHandler( | ||
filename=os.path.join(path, 'anaconda_jsonserver.log'), | ||
filename=join(path, 'anaconda_jsonserver.log'), | ||
maxBytes=10000000, | ||
backupCount=5, | ||
encoding='utf-8' | ||
|
@@ -318,10 +323,10 @@ def log_traceback(): | |
PID = args[0] | ||
|
||
if options.project is not None: | ||
jedi_settings.cache_directory = os.path.join( | ||
jedi_settings.cache_directory = join( | ||
jedi_settings.cache_directory, options.project | ||
) | ||
log_directory = os.path.join(log_directory, options.project) | ||
log_directory = join(log_directory, options.project) | ||
|
||
if not os.path.exists(jedi_settings.cache_directory): | ||
os.makedirs(jedi_settings.cache_directory) | ||
|
@@ -338,8 +343,8 @@ def log_traceback(): | |
server = JSONServer(('localhost', port)) | ||
else: | ||
unix_socket_path = UnixSocketPath(options.project) | ||
if not os.path.exists(os.path.dirname(unix_socket_path.socket)): | ||
os.makedirs(os.path.dirname(unix_socket_path.socket)) | ||
if not os.path.exists(dirname(unix_socket_path.socket)): | ||
os.makedirs(dirname(unix_socket_path.socket)) | ||
if os.path.exists(unix_socket_path.socket): | ||
os.unlink(unix_socket_path.socket) | ||
server = JSONServer(unix_socket_path.socket) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
| | ||
_` | __ \ _` | __| _ \ __ \ _` | _` | | ||
( | | | ( | ( ( | | | ( | ( | | ||
\__,_| _| _| \__,_| \___| \___/ _| _| \__,_| \__,_| | ||
The Sublime Text 3 Python IDE | ||
|
||
|
||
Anaconda v2.1.33 | ||
================ | ||
|
||
Welcome to new anaconda v2.1.33, what can do you find in this minor release? | ||
|
||
## Fixes | ||
- Further fixing a bug introduced due to Windows WSL 1903 release |