forked from VimPlug/jedi
Remove from_executable, were not really using it, yet.
This commit is contained in:
@@ -42,5 +42,6 @@ from jedi.api import Script, Interpreter, set_debug_function, \
|
|||||||
preload_module, names
|
preload_module, names
|
||||||
from jedi import settings
|
from jedi import settings
|
||||||
from jedi.api.environment import find_virtualenvs, find_python_environments, \
|
from jedi.api.environment import find_virtualenvs, find_python_environments, \
|
||||||
get_default_environment, InvalidPythonEnvironment
|
get_default_environment, InvalidPythonEnvironment, create_environment, \
|
||||||
|
find_executable, get_python_environment
|
||||||
from jedi.api.exceptions import InternalError
|
from jedi.api.exceptions import InternalError
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ def get_python_environment(python):
|
|||||||
raise InvalidPythonEnvironment("Cannot find executable %s." % python)
|
raise InvalidPythonEnvironment("Cannot find executable %s." % python)
|
||||||
|
|
||||||
|
|
||||||
def create_environment(path, safe=False):
|
def create_environment(path, safe=True):
|
||||||
"""
|
"""
|
||||||
Make it possible to create an environment by hand.
|
Make it possible to create an environment by hand.
|
||||||
|
|
||||||
@@ -271,11 +271,6 @@ def create_environment(path, safe=False):
|
|||||||
return _Environment(path, _get_executable_path(path, safe=safe))
|
return _Environment(path, _get_executable_path(path, safe=safe))
|
||||||
|
|
||||||
|
|
||||||
def from_executable(executable):
|
|
||||||
path = os.path.dirname(os.path.dirname(executable))
|
|
||||||
return _Environment(path, executable)
|
|
||||||
|
|
||||||
|
|
||||||
def _get_executable_path(path, safe=True):
|
def _get_executable_path(path, safe=True):
|
||||||
"""
|
"""
|
||||||
Returns None if it's not actually a virtual env.
|
Returns None if it's not actually a virtual env.
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import json
|
|||||||
|
|
||||||
from jedi._compatibility import FileNotFoundError, NotADirectoryError
|
from jedi._compatibility import FileNotFoundError, NotADirectoryError
|
||||||
from jedi.api.environment import SameEnvironment, \
|
from jedi.api.environment import SameEnvironment, \
|
||||||
get_default_environment, from_executable
|
get_default_environment
|
||||||
from jedi.api.exceptions import WrongVersion
|
from jedi.api.exceptions import WrongVersion
|
||||||
from jedi._compatibility import force_unicode
|
from jedi._compatibility import force_unicode
|
||||||
from jedi.evaluate.sys_path import discover_buildout_paths
|
from jedi.evaluate.sys_path import discover_buildout_paths
|
||||||
@@ -30,9 +30,9 @@ def _force_unicode_list(lst):
|
|||||||
|
|
||||||
|
|
||||||
class Project(object):
|
class Project(object):
|
||||||
|
# TODO serialize environment
|
||||||
_serializer_ignore_attributes = ('_environment',)
|
_serializer_ignore_attributes = ('_environment',)
|
||||||
_environment = None
|
_environment = None
|
||||||
_executable = None
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _get_json_path(base_path):
|
def _get_json_path(base_path):
|
||||||
@@ -49,8 +49,6 @@ class Project(object):
|
|||||||
if version == 1:
|
if version == 1:
|
||||||
self = cls.__new__()
|
self = cls.__new__()
|
||||||
self.__dict__.update(data)
|
self.__dict__.update(data)
|
||||||
if self._executable is not None:
|
|
||||||
self._environment = from_executable(self._executable)
|
|
||||||
return self
|
return self
|
||||||
else:
|
else:
|
||||||
raise WrongVersion(
|
raise WrongVersion(
|
||||||
@@ -72,7 +70,6 @@ class Project(object):
|
|||||||
self._path = path
|
self._path = path
|
||||||
if isinstance(environment, SameEnvironment):
|
if isinstance(environment, SameEnvironment):
|
||||||
self._environment = environment
|
self._environment = environment
|
||||||
self._executable = environment._executable
|
|
||||||
|
|
||||||
self._sys_path = sys_path
|
self._sys_path = sys_path
|
||||||
self._smart_sys_path = smart_sys_path
|
self._smart_sys_path = smart_sys_path
|
||||||
|
|||||||
Reference in New Issue
Block a user