From bc9074d515990feea35469e9dc090c9ec00d8721eea14167021deda6860526ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Tue, 5 Nov 2019 11:34:28 +0000 Subject: [PATCH] Accepting request 745249 from home:bnavigator:branches:devel:languages:python:numeric - fix segfault: run only those tests that require xvfb with xvfb-run - fix i586 build fail: add upstream PR#317 to replace float128 OBS-URL: https://build.opensuse.org/request/show/745249 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-control?expand=0&rev=4 --- python-control-pr317.patch | 143 +++++++++++++++++++++++++++++++++++++ python-control.changes | 6 ++ python-control.spec | 22 ++++-- 3 files changed, 165 insertions(+), 6 deletions(-) create mode 100644 python-control-pr317.patch diff --git a/python-control-pr317.patch b/python-control-pr317.patch new file mode 100644 index 0000000..400c3d6 --- /dev/null +++ b/python-control-pr317.patch @@ -0,0 +1,143 @@ +From e1e319f844edb2e6a22aa815ca42806d47c6cf5f Mon Sep 17 00:00:00 2001 +From: Rory Yorke +Date: Sun, 23 Jun 2019 14:46:23 +0200 +Subject: [PATCH] Use numpy.longdouble instead of numpy.float128 in testing + +numpy.float128 doesn't exist on all platforms, e.g., Windows 64-bit. + +When numpy.float128 does exist (e.g., Linux 64-bit), it's typically an +alias for numpy.longdouble. +--- + control/tests/xferfcn_input_test.py | 28 ++++++++++++++-------------- + 1 file changed, 14 insertions(+), 14 deletions(-) + +diff --git a/control/tests/xferfcn_input_test.py b/control/tests/xferfcn_input_test.py +index 0471e885..0d6ca56f 100644 +--- a/control/tests/xferfcn_input_test.py ++++ b/control/tests/xferfcn_input_test.py +@@ -7,7 +7,7 @@ + import numpy as np + + from numpy import int, int8, int16, int32, int64 +-from numpy import float, float16, float32, float64, float128 ++from numpy import float, float16, float32, float64, longdouble + from numpy import all, ndarray, array + + from control.xferfcn import _clean_part +@@ -73,7 +73,7 @@ def test_clean_part_tuple(self): + + def test_clean_part_all_scalar_types(self): + """Test single scalar value for all valid data types.""" +- for dtype in [int, int8, int16, int32, int64, float, float16, float32, float64, float128]: ++ for dtype in [int, int8, int16, int32, int64, float, float16, float32, float64, longdouble]: + num = dtype(1) + num_ = _clean_part(num) + +@@ -92,7 +92,7 @@ def test_clean_part_np_array(self): + + def test_clean_part_all_np_array_types(self): + """Test scalar value in numpy array of ndim=0 for all data types.""" +- for dtype in [int, int8, int16, int32, int64, float, float16, float32, float64, float128]: ++ for dtype in [int, int8, int16, int32, int64, float, float16, float32, float64, longdouble]: + num = np.array(1, dtype=dtype) + num_ = _clean_part(num) + +@@ -102,7 +102,7 @@ def test_clean_part_all_np_array_types(self): + + def test_clean_part_all_np_array_types2(self): + """Test numpy array for all types.""" +- for dtype in [int, int8, int16, int32, int64, float, float16, float32, float64, float128]: ++ for dtype in [int, int8, int16, int32, int64, float, float16, float32, float64, longdouble]: + num = np.array([1, 2], dtype=dtype) + num_ = _clean_part(num) + +@@ -112,7 +112,7 @@ def test_clean_part_all_np_array_types2(self): + + def test_clean_part_list_all_types(self): + """Test list of a single value for all data types.""" +- for dtype in [int, int8, int16, int32, int64, float, float16, float32, float64, float128]: ++ for dtype in [int, int8, int16, int32, int64, float, float16, float32, float64, longdouble]: + num = [dtype(1)] + num_ = _clean_part(num) + assert isinstance(num_, list) +@@ -121,7 +121,7 @@ def test_clean_part_list_all_types(self): + + def test_clean_part_list_all_types2(self): + """List of list of numbers of all data types.""" +- for dtype in [int, int8, int16, int32, int64, float, float16, float32, float64, float128]: ++ for dtype in [int, int8, int16, int32, int64, float, float16, float32, float64, longdouble]: + num = [dtype(1), dtype(2)] + num_ = _clean_part(num) + assert isinstance(num_, list) +@@ -130,7 +130,7 @@ def test_clean_part_list_all_types2(self): + + def test_clean_part_tuple_all_types(self): + """Test tuple of a single value for all data types.""" +- for dtype in [int, int8, int16, int32, int64, float, float16, float32, float64, float128]: ++ for dtype in [int, int8, int16, int32, int64, float, float16, float32, float64, longdouble]: + num = (dtype(1),) + num_ = _clean_part(num) + assert isinstance(num_, list) +@@ -139,7 +139,7 @@ def test_clean_part_tuple_all_types(self): + + def test_clean_part_tuple_all_types2(self): + """Test tuple of a single value for all data types.""" +- for dtype in [int, int8, int16, int32, int64, float, float16, float32, float64, float128]: ++ for dtype in [int, int8, int16, int32, int64, float, float16, float32, float64, longdouble]: + num = (dtype(1), dtype(2)) + num_ = _clean_part(num) + assert isinstance(num_, list) +@@ -184,7 +184,7 @@ def test_clean_part_list_list_list_floats(self): + + def test_clean_part_list_list_array(self): + """List of list of numpy arrays for all valid types.""" +- for dtype in int, int8, int16, int32, int64, float, float16, float32, float64, float128: ++ for dtype in int, int8, int16, int32, int64, float, float16, float32, float64, longdouble: + num = [[array([1, 1], dtype=dtype), array([2, 2], dtype=dtype)]] + num_ = _clean_part(num) + +@@ -195,7 +195,7 @@ def test_clean_part_list_list_array(self): + + def test_clean_part_tuple_list_array(self): + """Tuple of list of numpy arrays for all valid types.""" +- for dtype in int, int8, int16, int32, int64, float, float16, float32, float64, float128: ++ for dtype in int, int8, int16, int32, int64, float, float16, float32, float64, longdouble: + num = ([array([1, 1], dtype=dtype), array([2, 2], dtype=dtype)],) + num_ = _clean_part(num) + +@@ -206,7 +206,7 @@ def test_clean_part_tuple_list_array(self): + + def test_clean_part_list_tuple_array(self): + """List of tuple of numpy array for all valid types.""" +- for dtype in int, int8, int16, int32, int64, float, float16, float32, float64, float128: ++ for dtype in int, int8, int16, int32, int64, float, float16, float32, float64, longdouble: + num = [(array([1, 1], dtype=dtype), array([2, 2], dtype=dtype))] + num_ = _clean_part(num) + +@@ -217,7 +217,7 @@ def test_clean_part_list_tuple_array(self): + + def test_clean_part_tuple_tuples_arrays(self): + """Tuple of tuples of numpy arrays for all valid types.""" +- for dtype in int, int8, int16, int32, int64, float, float16, float32, float64, float128: ++ for dtype in int, int8, int16, int32, int64, float, float16, float32, float64, longdouble: + num = ((array([1, 1], dtype=dtype), array([2, 2], dtype=dtype)), + (array([3, 4], dtype=dtype), array([4, 4], dtype=dtype))) + num_ = _clean_part(num) +@@ -229,7 +229,7 @@ def test_clean_part_tuple_tuples_arrays(self): + + def test_clean_part_list_tuples_arrays(self): + """List of tuples of numpy arrays for all valid types.""" +- for dtype in int, int8, int16, int32, int64, float, float16, float32, float64, float128: ++ for dtype in int, int8, int16, int32, int64, float, float16, float32, float64, longdouble: + num = [(array([1, 1], dtype=dtype), array([2, 2], dtype=dtype)), + (array([3, 4], dtype=dtype), array([4, 4], dtype=dtype))] + num_ = _clean_part(num) +@@ -241,7 +241,7 @@ def test_clean_part_list_tuples_arrays(self): + + def test_clean_part_list_list_arrays(self): + """List of list of numpy arrays for all valid types.""" +- for dtype in int, int8, int16, int32, int64, float, float16, float32, float64, float128: ++ for dtype in int, int8, int16, int32, int64, float, float16, float32, float64, longdouble: + num = [[array([1, 1], dtype=dtype), array([2, 2], dtype=dtype)], + [array([3, 3], dtype=dtype), array([4, 4], dtype=dtype)]] + num_ = _clean_part(num) diff --git a/python-control.changes b/python-control.changes index aa5c3a7..f89a1c9 100644 --- a/python-control.changes +++ b/python-control.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Nov 4 13:25:48 UTC 2019 - Benjamin Greiner + +- fix segfault: run only those tests that require xvfb with xvfb-run +- fix i586 build fail: add upstream PR#317 to replace float128 + ------------------------------------------------------------------- Thu Jun 27 13:12:31 UTC 2019 - Benjamin Greiner diff --git a/python-control.spec b/python-control.spec index 50c54e0..182222e 100644 --- a/python-control.spec +++ b/python-control.spec @@ -22,14 +22,13 @@ Version: 0.8.2 Release: 0 Summary: Python control systems library License: BSD-3-Clause -Group: Development/Languages/Python URL: http://python-control.sourceforge.net Source: https://files.pythonhosted.org/packages/source/c/control/control-%{version}.tar.gz Patch0: python-control-fixtestaugw.patch +Patch1: python-control-pr317.patch BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros -Requires: python-matplotlib Requires: python-numpy Requires: python-scipy Recommends: python-slycot @@ -37,6 +36,7 @@ BuildArch: noarch # SECTION test requirements BuildRequires: %{python_module matplotlib-qt5} BuildRequires: %{python_module matplotlib} +BuildRequires: %{python_module nose-exclude} BuildRequires: %{python_module nose} BuildRequires: %{python_module numpy} BuildRequires: %{python_module scipy} @@ -53,6 +53,7 @@ operations for analysis and design of feedback control systems. %prep %setup -q -n control-%{version} %patch0 -p1 +%patch1 -p1 %build %python_build @@ -63,12 +64,21 @@ operations for analysis and design of feedback control systems. %check # The default Agg backend does not define the toolbar attribute in the Figure -# Manager used by some tests, so we run the Qt5 backend in a virtual X server -# environment -export MPLBACKEND="Qt5Agg" +# Manager used by some tests, so we run those tests with the Qt5 backend in a +# virtual X server environment +%if %{_arch} == i386 + export LD_PRELOAD="%{_libdir}/libtcmalloc_minimal.so.4" +%endif %{python_expand export PYTHONPATH=%{buildroot}%{$python_sitelib} +export MPLBACKEND="Agg" +nosetests-%$python_bin_suffix \ + --exclude-test control.tests.sisotool_test \ + --exclude-test control.tests.rlocus_test +export MPLBACKEND="Qt5Agg" export LD_PRELOAD="%{_libdir}/libtcmalloc_minimal.so.4" -xvfb-run -a $python setup.py test +xvfb-run -a nosetests-%$python_bin_suffix \ + control.tests.sisotool_test \ + control.tests.rlocus_test } %files %{python_files}