Package: python-jedi Version: 0.17.2-1 Severity: important Control: tag -1 +patch
Hi Piotr, Sorry to bother you again so soon! With 0.17.2-1 I was able to make progress debugging Elpy's pytests, and I think I found one more issue in python-jedi. I've attached a (tested) patch, which I hope you'll agree is the correct approach, and if not, please advise how else to proceed. With this fix I was finally able to begin to identify the issues specific to Elpy :-) ____________ TestRPCGetNames.test_should_not_fail_with_args_as_args ____________ elpy/tests/test_jedibackend.py:30: in setUp self.backend = jedibackend.JediBackend(self.project_root, env) elpy/jedibackend.py:32: in __init__ self.environment = jedi.create_environment(environment_binaries_path, /usr/lib/python3/dist-packages/jedi/api/environment.py:379: in create_environment return _create_environment(path, safe, **kwargs) /usr/lib/python3/dist-packages/jedi/api/environment.py:386: in _create_environment return Environment(_get_executable_path(path, safe=safe), env_vars=env_vars) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path = '/usr', safe = False def _get_executable_path(path, safe=True): """ Returns None if it's not actually a virtual env. """ if os.name == 'nt': python = os.path.join(path, 'Scripts', 'python.exe') else: python = os.path.join(path, 'bin', 'python') if not os.path.exists(python): > raise InvalidPythonEnvironment("%s seems to be missing." % python) E jedi.api.environment.InvalidPythonEnvironment: /usr/bin/python seems to be missing. /usr/lib/python3/dist-packages/jedi/api/environment.py:399: InvalidPythonEnvironment Regards, Nicholas
>From 3fce4962ea0089e1168ecee99a58e93c9e3eed2d Mon Sep 17 00:00:00 2001 From: Nicholas D Steeves <nstee...@gmail.com> Date: Sun, 20 Dec 2020 21:56:42 -0500 Subject: [PATCH] Add 0001-Search-for-python3-in-_get_executable_path.patch --- debian/changelog | 8 ++++++ ...-for-python3-in-_get_executable_path.patch | 26 +++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 35 insertions(+) create mode 100644 debian/patches/0001-Search-for-python3-in-_get_executable_path.patch create mode 100644 debian/patches/series diff --git a/debian/changelog b/debian/changelog index 0ee5a6a..8c0c8ae 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +python-jedi (0.17.2-2) UNRELEASED; urgency=medium + + [ Nicholas D Steeves ] + * Add 0001-Search-for-python3-in-_get_executable_path.patch. See message + in patch header for more information. + + -- Nicholas D Steeves <nstee...@gmail.com> Sun, 20 Dec 2020 21:54:56 -0500 + python-jedi (0.17.2-1) unstable; urgency=medium * New upstream release (closes: 977558) diff --git a/debian/patches/0001-Search-for-python3-in-_get_executable_path.patch b/debian/patches/0001-Search-for-python3-in-_get_executable_path.patch new file mode 100644 index 0000000..34253b4 --- /dev/null +++ b/debian/patches/0001-Search-for-python3-in-_get_executable_path.patch @@ -0,0 +1,26 @@ +From: Nicholas D Steeves <nstee...@gmail.com> +Date: Sun, 20 Dec 2020 21:53:19 -0500 +Subject: Search for python3 in _get_executable_path +Forwarded: not-needed + +Python2 is no longer supported in Debian, and our virtual environments +provide both bin/python and bin/python3. + +This change is required for Elpy's pytests to not fail due to missing /usr/bin/python. +--- + jedi/api/environment.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/jedi/api/environment.py b/jedi/api/environment.py +index 89e4716..61f34f0 100644 +--- a/jedi/api/environment.py ++++ b/jedi/api/environment.py +@@ -394,7 +394,7 @@ def _get_executable_path(path, safe=True): + if os.name == 'nt': + python = os.path.join(path, 'Scripts', 'python.exe') + else: +- python = os.path.join(path, 'bin', 'python') ++ python = os.path.join(path, 'bin', 'python3') + if not os.path.exists(python): + raise InvalidPythonEnvironment("%s seems to be missing." % python) + diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..9d9ce29 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +0001-Search-for-python3-in-_get_executable_path.patch -- 2.29.2