Hello community, here is the log from the commit of package python-Pydap for openSUSE:Factory checked in at 2020-08-18 15:08:07 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-Pydap (Old) and /work/SRC/openSUSE:Factory/.python-Pydap.new.3399 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-Pydap" Tue Aug 18 15:08:07 2020 rev:5 rq:826797 version:3.2.2 Changes: -------- --- /work/SRC/openSUSE:Factory/python-Pydap/python-Pydap.changes 2020-04-21 13:09:28.760670129 +0200 +++ /work/SRC/openSUSE:Factory/.python-Pydap.new.3399/python-Pydap.changes 2020-08-18 15:08:16.367971705 +0200 @@ -1,0 +2,8 @@ +Sat Aug 15 06:06:47 UTC 2020 - John Vandenberg <[email protected]> + +- Apply merged_pr_173.patch to fix Python 3 +- Re-add gsw as a BuildRequires and Recommends as the middleware + requires it +- Re-activate test suite, removing nose + +------------------------------------------------------------------- New: ---- merged_pr_173.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-Pydap.spec ++++++ --- /var/tmp/diff_new_pack.inRQZh/_old 2020-08-18 15:08:17.891972335 +0200 +++ /var/tmp/diff_new_pack.inRQZh/_new 2020-08-18 15:08:17.891972335 +0200 @@ -17,7 +17,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} -%bcond_without python2 +%define skip_python2 1 Name: python-Pydap Version: 3.2.2 Release: 0 @@ -26,6 +26,7 @@ Group: Development/Languages/Python URL: https://github.com/pydap/pydap Source: https://files.pythonhosted.org/packages/source/P/Pydap/Pydap-%{version}.tar.gz +Patch0: merged_pr_173.patch BuildRequires: %{python_module Jinja2} BuildRequires: %{python_module PasteDeploy} BuildRequires: %{python_module WebOb} @@ -33,26 +34,19 @@ BuildRequires: %{python_module beautifulsoup4} BuildRequires: %{python_module coards} BuildRequires: %{python_module docopt} -BuildRequires: %{python_module flake8} BuildRequires: %{python_module gunicorn} +BuildRequires: %{python_module gsw} BuildRequires: %{python_module lxml} BuildRequires: %{python_module netCDF4} -BuildRequires: %{python_module nose} BuildRequires: %{python_module numpy-devel} BuildRequires: %{python_module pytest >= 2.8} BuildRequires: %{python_module pytest-attrib} -BuildRequires: %{python_module pytest-cov} BuildRequires: %{python_module requests-mock} BuildRequires: %{python_module requests} BuildRequires: %{python_module setuptools} BuildRequires: %{python_module six >= 1.4} BuildRequires: fdupes -%if %{with python2} -BuildRequires: python-mock -BuildRequires: python-singledispatch -%endif BuildRequires: python-rpm-macros -BuildRequires: python3-gsw Requires: python-Jinja2 Requires: python-WebOb Requires: python-beautifulsoup4 @@ -64,16 +58,11 @@ Recommends: python-PasteDeploy Recommends: python-coards Recommends: python-gunicorn +Recommends: python-gsw Recommends: python-lxml Recommends: python-netCDF4 Recommends: python-requests BuildArch: noarch -%ifpython3 -Recommends: python-gsw -%endif -%ifpython2 -Requires: python-singledispatch -%endif %python_subpackages %description @@ -86,6 +75,8 @@ %prep %setup -q -n Pydap-%{version} +%patch0 -p1 + rm -f docs/_build/html/.buildinfo %fdupes docs/_build/html @@ -106,7 +97,10 @@ %python_uninstall_alternative pydap dods %check -%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} $python setup.py nosetests || : +# test_timeout requires network +# test_body & test_iteration errors: https://github.com/pydap/pydap/issues/214 +# test_iter_data i586 errirs: https://github.com/pydap/pydap/issues/215 +%pytest -k 'not test_timeout and not (TestDODSResponseNestedSequence and test_body) and not (TestDODSResponseNestedSequence and test_iteration) and not (test_iter_data and (test_dtype or test_nested_dtype))' %files %{python_files} %doc CONTRIBUTORS.md NEWS.md README.md docs/_build/html ++++++ merged_pr_173.patch ++++++ >From 1588abed3fb4a43b26b4a28736894e8410028e26 Mon Sep 17 00:00:00 2001 From: Roberto De Almeida <[email protected]> Date: Fri, 12 Oct 2018 22:36:24 -0700 Subject: [PATCH 1/3] Fix unit tests in Python 3.5 --- src/pydap/handlers/dap.py | 12 ++++++------ src/pydap/lib.py | 15 +++++++++++---- src/pydap/tests/test_lib.py | 3 +++ src/pydap/tests/test_responses_ascii.py | 1 - 4 files changed, 20 insertions(+), 11 deletions(-) Index: Pydap-3.2.2/src/pydap/handlers/dap.py =================================================================== --- Pydap-3.2.2.orig/src/pydap/handlers/dap.py +++ Pydap-3.2.2/src/pydap/handlers/dap.py @@ -323,7 +323,7 @@ def unpack_sequence(stream, template): dtype = np.dtype([("", c.dtype, c.shape) for c in cols]) marker = stream.read(4) while marker == START_OF_SEQUENCE: - rec = np.fromstring(stream.read(dtype.itemsize), dtype=dtype)[0] + rec = np.frombuffer(stream.read(dtype.itemsize), dtype=dtype)[0] if not sequence: rec = rec[0] yield rec @@ -363,14 +363,14 @@ def convert_stream_to_list(stream, parse out = [] response_dtype = DAP2_response_dtypemap(parser_dtype) if shape: - n = np.fromstring(stream.read(4), DAP2_ARRAY_LENGTH_NUMPY_TYPE)[0] + n = np.frombuffer(stream.read(4), DAP2_ARRAY_LENGTH_NUMPY_TYPE)[0] count = response_dtype.itemsize * n if response_dtype.char in 'S': # Consider on 'S' and not 'SU' because # response_dtype.char should never be data = [] for _ in range(n): - k = np.fromstring(stream.read(4), + k = np.frombuffer(stream.read(4), DAP2_ARRAY_LENGTH_NUMPY_TYPE)[0] data.append(stream.read(k)) stream.read(-k % 4) @@ -380,7 +380,7 @@ def convert_stream_to_list(stream, parse stream.read(4) # read additional length try: out.append( - np.fromstring( + np.frombuffer( stream.read(count), response_dtype) .astype(parser_dtype).reshape(shape)) except ValueError as e: @@ -403,13 +403,13 @@ def convert_stream_to_list(stream, parse # Consider on 'S' and not 'SU' because # response_dtype.char should never be # 'U' - k = np.fromstring(stream.read(4), DAP2_ARRAY_LENGTH_NUMPY_TYPE)[0] + k = np.frombuffer(stream.read(4), DAP2_ARRAY_LENGTH_NUMPY_TYPE)[0] out.append(text_type(stream.read(k).decode('ascii'))) stream.read(-k % 4) # usual data else: out.append( - np.fromstring(stream.read(response_dtype.itemsize), response_dtype) + np.frombuffer(stream.read(response_dtype.itemsize), response_dtype) .astype(parser_dtype)[0]) if response_dtype.char == "B": # Unsigned Byte type is packed to multiples of 4 bytes: Index: Pydap-3.2.2/src/pydap/lib.py =================================================================== --- Pydap-3.2.2.orig/src/pydap/lib.py +++ Pydap-3.2.2/src/pydap/lib.py @@ -1,10 +1,11 @@ """Basic functions related to the DAP spec.""" import operator +import numpy as np from pkg_resources import get_distribution from six.moves.urllib.parse import quote as quote_ from six.moves import reduce, zip_longest -from six import binary_type, MAXSIZE +from six import binary_type, MAXSIZE, string_types from .exceptions import ConstraintExpressionError @@ -123,6 +124,13 @@ def quote(name): def encode(obj): """Return an object encoded to its DAP representation.""" + # fix for Python 3.5, where strings are being encoded as numbers + if ( + isinstance(obj, string_types) or + isinstance(obj, np.ndarray) and obj.dtype.char in 'SU' + ): + return '"{0}"'.format(obj) + try: return '%.6g' % obj except: Index: Pydap-3.2.2/src/pydap/tests/test_lib.py =================================================================== --- Pydap-3.2.2.orig/src/pydap/tests/test_lib.py +++ Pydap-3.2.2/src/pydap/tests/test_lib.py @@ -66,6 +66,9 @@ class TestEncode(unittest.TestCase): """Other objects are encoded according to their ``repr``.""" self.assertEqual(encode({}), '"{}"') + def test_numpy_string(self): + self.assertEqual(encode(np.array('1', dtype='<U1')), '"1"') + class TestFixSlice(unittest.TestCase): Index: Pydap-3.2.2/src/pydap/tests/test_responses_ascii.py =================================================================== --- Pydap-3.2.2.orig/src/pydap/tests/test_responses_ascii.py +++ Pydap-3.2.2/src/pydap/tests/test_responses_ascii.py @@ -41,7 +41,6 @@ class TestASCIIResponseSequence(unittest def test_headers(self): """Test headers from the response.""" - print(self.res.text) self.assertEqual( self.res.headers, ResponseHeaders([
