Imported upstream fix for PyYAML 5.x
This commit is contained in:
parent
c8b6fbe930
commit
5890385a58
49
python-astropy-fix-pyyaml5-8500.patch
Normal file
49
python-astropy-fix-pyyaml5-8500.patch
Normal file
@ -0,0 +1,49 @@
|
||||
From c531e498de2c4d39a0eccc02f92a3645a8394dee Mon Sep 17 00:00:00 2001
|
||||
From: Tom Aldcroft <taldcroft@gmail.com>
|
||||
Date: Fri, 15 Mar 2019 11:30:46 -0400
|
||||
Subject: [PATCH 1/2] Set YAML default_flow_style=None for consistent output
|
||||
with PyYAML version >= 5.1
|
||||
|
||||
---
|
||||
astropy/io/misc/tests/test_hdf5.py | 3 ++-
|
||||
astropy/io/misc/yaml.py | 1 +
|
||||
astropy/table/meta.py | 3 ++-
|
||||
4 files changed, 8 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/astropy/io/misc/tests/test_hdf5.py b/astropy/io/misc/tests/test_hdf5.py
|
||||
index 25f29ebc5ed..9ab6924bee3 100644
|
||||
--- a/astropy/io/misc/tests/test_hdf5.py
|
||||
+++ b/astropy/io/misc/tests/test_hdf5.py
|
||||
@@ -538,7 +538,8 @@ def test_fail_meta_serialize(tmpdir):
|
||||
|
||||
with pytest.raises(Exception) as err:
|
||||
t1.write(test_file, path='the_table', serialize_meta=True)
|
||||
- assert "cannot represent an object: <class 'str'>" in str(err)
|
||||
+ assert "cannot represent an object" in str(err)
|
||||
+ assert "<class 'str'>" in str(err)
|
||||
|
||||
|
||||
@pytest.mark.skipif('not HAS_H5PY')
|
||||
diff --git a/astropy/io/misc/yaml.py b/astropy/io/misc/yaml.py
|
||||
index 6f5146c432b..5276ed7d8fe 100644
|
||||
--- a/astropy/io/misc/yaml.py
|
||||
+++ b/astropy/io/misc/yaml.py
|
||||
@@ -352,4 +352,5 @@ def dump(data, stream=None, **kwargs):
|
||||
|
||||
"""
|
||||
kwargs['Dumper'] = AstropyDumper
|
||||
+ kwargs.setdefault('default_flow_style', None)
|
||||
return yaml.dump(data, stream=stream, **kwargs)
|
||||
diff --git a/astropy/table/meta.py b/astropy/table/meta.py
|
||||
index 9b55522a72b..8837cb3db12 100644
|
||||
--- a/astropy/table/meta.py
|
||||
+++ b/astropy/table/meta.py
|
||||
@@ -287,7 +287,8 @@ def represent_mapping(self, tag, mapping, flow_style=None):
|
||||
header['datatype'] = [_get_col_attributes(col) for col in header['cols']]
|
||||
del header['cols']
|
||||
|
||||
- lines = yaml.dump(header, Dumper=TableDumper, width=130).splitlines()
|
||||
+ lines = yaml.dump(header, default_flow_style=None,
|
||||
+ Dumper=TableDumper, width=130).splitlines()
|
||||
return lines
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
Name: python-astropy
|
||||
Version: 3.1.2
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Summary: A Community Python Library for Astronomy
|
||||
License: BSD
|
||||
|
||||
@ -22,6 +22,9 @@ Source1: astropy-README.dist
|
||||
Source2: astropy-ply.py
|
||||
Patch0: python-astropy-system-configobj.patch
|
||||
Patch1: python-astropy-system-six.patch
|
||||
# Import upstream fix for PyYAML 5
|
||||
# https://github.com/astropy/astropy/pull/8500
|
||||
Patch2: python-astropy-fix-pyyaml5-8500.patch
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: git
|
||||
@ -136,6 +139,8 @@ rm -rf astropy*egg-info
|
||||
%patch1 -p1
|
||||
# Use system ply
|
||||
cp %{SOURCE2} astropy/extern/ply.py
|
||||
# Fix for PyYAML 5.x
|
||||
%patch2 -p1
|
||||
|
||||
# Force Cython re-run
|
||||
echo "cython_version = 'unknown'" > astropy/cython_version.py
|
||||
@ -181,22 +186,14 @@ find %{buildroot} -name "*.so" | xargs chmod 755
|
||||
export PYTHONDONTWRITEBYTECODE=1
|
||||
export PYTEST_ADDOPTS='-p no:cacheprovider'
|
||||
|
||||
# Disable test test_fail_meta_serialize until we have fixed Fedora pyyaml package
|
||||
# Disable test test_scale_back_with_blanks until we have a fix
|
||||
#
|
||||
# Tests on s390x tend to stuck (already for scipy used by astropy)
|
||||
%ifnarch s390x %{power64}
|
||||
%ifnarch s390x
|
||||
pushd %{buildroot}/%{python3_sitearch}
|
||||
py.test-%{python3_version} -k "not test_fail_meta_serialize" astropy
|
||||
py.test-%{python3_version} -k "not test_scale_back_with_blanks" astropy
|
||||
popd
|
||||
%endif # ifnarch s390x %{power64}
|
||||
|
||||
# Execute tests on power64 excluding failing test_str, test_fail_meta_serialize and test_write_read_roundtrip
|
||||
%ifarch %{power64}
|
||||
pushd %{buildroot}/%{python3_sitearch}
|
||||
py.test-%{python3_version} -x -k "not (test_fail_meta_serialize or test_str or test_write_read_roundtrip)" astropy
|
||||
popd
|
||||
%endif # ifarch %{power64}
|
||||
|
||||
%endif # ifnarch s390x
|
||||
|
||||
%files -n %{srcname}-tools
|
||||
%{_bindir}/*
|
||||
@ -213,6 +210,9 @@ popd
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri Mar 29 2019 Christian Dersch <lupinix@fedoraproject.org> - 3.1.2-2
|
||||
- Imported upstream fix for PyYAML 5.x
|
||||
|
||||
* Mon Mar 04 2019 Sergio Pascual <sergiopr@fedoraproject.org> - 3.1.2-1
|
||||
- New version (3.1.2)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user