Accepting request 680892 from devel:languages:python

- Rebase the patch to the current git state

- Add support for Python <3.5, using upstream commit as
  test-sys-executable.patch to fix the tests, replacing custom sed.
- Remove unnecessary buid dependency on pytest and pytest-xdist

OBS-URL: https://build.opensuse.org/request/show/680892
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-typing_extensions?expand=0&rev=3
This commit is contained in:
Dominique Leuenberger 2019-03-04 08:23:05 +00:00 committed by Git OBS Bridge
commit 5786ad2b53
3 changed files with 69 additions and 9 deletions

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Sat Mar 2 14:11:52 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Rebase the patch to the current git state
-------------------------------------------------------------------
Sat Mar 2 02:47:44 UTC 2019 - John Vandenberg <jayvdb@gmail.com>
- Add support for Python <3.5, using upstream commit as
test-sys-executable.patch to fix the tests, replacing custom sed.
- Remove unnecessary buid dependency on pytest and pytest-xdist
-------------------------------------------------------------------
Thu Feb 28 09:01:37 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>

View File

@ -16,7 +16,6 @@
#
%define skip_python2 1
%define modname typing_extensions
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-typing_extensions
@ -27,13 +26,22 @@ License: Python-2.0
Group: Development/Languages/Python
URL: https://github.com/python/typing/
Source0: https://files.pythonhosted.org/packages/source/t/typing_extensions/%{modname}-%{version}.tar.gz
BuildRequires: %{python_module pytest >= 3.0}
BuildRequires: %{python_module pytest-xdist >= 1.18}
Patch0: test-sys-executable.patch
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module testsuite}
BuildRequires: %{python_module typing}
%if 0%{?suse_version} > 1320
BuildRequires: python3-testsuite
%endif
BuildRequires: fdupes
BuildRequires: python-rpm-macros
%if %{python3_version_nodots} < 35
Requires: python3-typing
%endif
%ifpython2
Requires: python2-typing
%endif
BuildArch: noarch
%python_subpackages
%description
@ -55,8 +63,7 @@ Python versions or requires experimental types.
%prep
%setup -q -n %{modname}-%{version}
# Workaround https://github.com/python/typing/pull/615
sed -i 's/python -OO/python3 -OO/' src_py3/test_typing_extensions.py
%patch0 -p2
%build
%python_build
@ -66,12 +73,14 @@ sed -i 's/python -OO/python3 -OO/' src_py3/test_typing_extensions.py
%fdupes %{buildroot}%{python3_sitelib}
%check
cd src_py3
%__python3 test_typing_extensions.py
# X.Y -> X
%{python_expand current_bin_suffix=%{$python_bin_suffix}
$python src_py${current_bin_suffix:0:1}/test_typing_extensions.py
}
%files %{python_files}
%license LICENSE
%doc README.rst
%{python3_sitelib}/*
%{python_sitelib}/*
%changelog

39
test-sys-executable.patch Normal file
View File

@ -0,0 +1,39 @@
From 1f49677868a60ed697b0eafb2fb56471233b4ea5 Mon Sep 17 00:00:00 2001
From: "Michael R. Crusoe" <1330696+mr-c@users.noreply.github.com>
Date: Thu, 14 Feb 2019 12:25:27 +0200
Subject: [PATCH] Run the tests using the current Python executable (#615)
Not whatever "python" might be.
---
typing_extensions/src_py2/test_typing_extensions.py | 3 ++-
typing_extensions/src_py3/test_typing_extensions.py | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/typing_extensions/src_py2/test_typing_extensions.py b/typing_extensions/src_py2/test_typing_extensions.py
index eb5acf3..922d8cd 100644
--- a/typing_extensions/src_py2/test_typing_extensions.py
+++ b/typing_extensions/src_py2/test_typing_extensions.py
@@ -860,7 +860,8 @@ def test_typing_extensions_compiles_with_opt(self):
file_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),
'typing_extensions.py')
try:
- subprocess.check_output('python -OO {}'.format(file_path),
+ subprocess.check_output('{} -OO {}'.format(sys.executable,
+ file_path),
stderr=subprocess.STDOUT,
shell=True)
except subprocess.CalledProcessError:
diff --git a/typing_extensions/src_py3/test_typing_extensions.py b/typing_extensions/src_py3/test_typing_extensions.py
index eb0c64f..815e425 100644
--- a/typing_extensions/src_py3/test_typing_extensions.py
+++ b/typing_extensions/src_py3/test_typing_extensions.py
@@ -1389,7 +1389,8 @@ def test_typing_extensions_compiles_with_opt(self):
file_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),
'typing_extensions.py')
try:
- subprocess.check_output('python -OO {}'.format(file_path),
+ subprocess.check_output('{} -OO {}'.format(sys.executable,
+ file_path),
stderr=subprocess.STDOUT,
shell=True)
except subprocess.CalledProcessError: