Accepting request 878754 from devel:languages:python

OBS-URL: https://build.opensuse.org/request/show/878754
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-jedi?expand=0&rev=28
This commit is contained in:
Dominique Leuenberger 2021-04-15 14:56:37 +00:00 committed by Git OBS Bridge
commit e6b8cc5002
5 changed files with 103 additions and 8 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:86ed7d9b750603e4ba582ea8edc678657fb4007894a12bcf6f4bb97892f31d20
size 1139617

3
jedi-0.18.0.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:92550a404bad8afed881a137ec9a461fed49eca661414be45059329614ed0707
size 1127968

60
jedi-py39-pytest.patch Normal file
View File

@ -0,0 +1,60 @@
From 85ec94cf6518e3446c5b19048c046a784fed4130 Mon Sep 17 00:00:00 2001
From: Dave Halter <davidhalter88@gmail.com>
Date: Sat, 26 Dec 2020 03:32:17 +0100
Subject: [PATCH] Fix pytest issues, fixes #1699
---
jedi/plugins/pytest.py | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/jedi/plugins/pytest.py b/jedi/plugins/pytest.py
index cec237338..d0dfba018 100644
--- a/jedi/plugins/pytest.py
+++ b/jedi/plugins/pytest.py
@@ -5,6 +5,7 @@
from jedi.inference.imports import load_module_from_path
from jedi.inference.filters import ParserTreeFilter
from jedi.inference.base_value import NO_VALUES, ValueSet
+from jedi.inference.helpers import infer_call_of_leaf
_PYTEST_FIXTURE_MODULES = [
('_pytest', 'monkeypatch'),
@@ -147,18 +148,35 @@ class FixtureFilter(ParserTreeFilter):
def _filter(self, names):
for name in super()._filter(names):
funcdef = name.parent
+ # Class fixtures are not supported
if funcdef.type == 'funcdef':
- # Class fixtures are not supported
decorated = funcdef.parent
if decorated.type == 'decorated' and self._is_fixture(decorated):
yield name
def _is_fixture(self, decorated):
- for decorator in decorated.children:
+ decorators = decorated.children[0]
+ if decorators.type == 'decorators':
+ decorators = decorators.children
+ else:
+ decorators = [decorators]
+ for decorator in decorators:
dotted_name = decorator.children[1]
# A heuristic, this makes it faster.
if 'fixture' in dotted_name.get_code():
- for value in self.parent_context.infer_node(dotted_name):
+ if dotted_name.type == 'atom_expr':
+ # Since Python3.9 a decorator does not have dotted names
+ # anymore.
+ last_trailer = dotted_name.children[-1]
+ last_leaf = last_trailer.get_last_leaf()
+ if last_leaf == ')':
+ values = infer_call_of_leaf(
+ self.parent_context, last_leaf, cut_own_trailer=True)
+ else:
+ values = self.parent_context.infer_node(dotted_name)
+ else:
+ values = self.parent_context.infer_node(dotted_name)
+ for value in values:
if value.name.get_qualified_names(include_module_names=True) \
== ('_pytest', 'fixtures', 'fixture'):
return True

View File

@ -1,3 +1,35 @@
-------------------------------------------------------------------
Sat Mar 13 13:33:44 UTC 2021 - Ben Greiner <code@bnavigator.de>
- Add jedi-py39-pytest.patch to support Python 3.9
-------------------------------------------------------------------
Fri Dec 25 19:03:26 UTC 2020 - Matej Cepl <mcepl@suse.com>
- update to 0.18.0 (get it together with the latest python-parso just to
be sure):
- Dropped Python 2 and Python 3.5
- Using ``pathlib.Path()`` as an output instead of ``str`` in most
places:
- ``Project.path``
- ``Script.path``
- ``Definition.module_path``
- ``Refactoring.get_renames``
- ``Refactoring.get_changed_files``
- Functions with ``@property`` now return ``property`` instead of
``function`` in ``Name().type``
- Started using annotations
- Better support for the walrus operator
- Project attributes are now read accessible
- Removed all deprecations
This is likely going to be the last minor release before 1.0.
-------------------------------------------------------------------
Thu Sep 3 20:26:53 UTC 2020 - Matej Cepl <mcepl@suse.com>
- Revert back to 0.17.2.
-------------------------------------------------------------------
Thu Aug 27 11:04:42 UTC 2020 - Benjamin Greiner <code@bnavigator.de>

View File

@ -1,7 +1,7 @@
#
# spec file for package python-jedi
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -17,8 +17,9 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
Name: python-jedi
Version: 0.17.2
Version: 0.18.0
Release: 0
Summary: An autocompletion tool for Python
License: MIT AND Python-2.0
@ -26,14 +27,16 @@ Group: Development/Languages/Python
URL: https://github.com/davidhalter/jedi
Source0: https://files.pythonhosted.org/packages/source/j/jedi/jedi-%{version}.tar.gz
Source1: %{name}-rpmlintrc
BuildRequires: %{python_module parso >= 0.7.0}
# PATCH-FIX-UPSTREAM Support pytest completion for Python 3.9 -- gh#davidhalter/jedi#1699
Patch0: https://github.com/davidhalter/jedi/commit/85ec94cf.patch#/jedi-py39-pytest.patch
BuildRequires: %{python_module parso >= 0.8.0}
# need pytest 5 https://github.com/davidhalter/jedi/issues/1660
BuildRequires: %{python_module pytest < 6.0.0}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module typing}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-parso >= 0.7.0
Requires: python-parso >= 0.8.0
BuildArch: noarch
%python_subpackages
@ -51,7 +54,7 @@ Jedi uses an API to connect with IDEs. There is a reference
implementation as a VIM plugin which uses Jedi's autocompletion.
%prep
%setup -q -n jedi-%{version}
%autosetup -p1 -n jedi-%{version}
%build
%python_build