068bbf7
# avoid providing the private libs:
abafbcf
%global __provides_exclude_from ^(%{python3_sitearch})/.*\\.so.*$
068bbf7
7180476
Name:       pygrib
d647f2b
Version:    2.1.4
5c0bce6
Release:    5%{?dist}
536850c
Summary:    Python module for reading and modifying GRIB files
7180476
068bbf7
License:    MIT
068bbf7
URL:        https://github.com/jswhit/%{name}
068bbf7
Source0:    https://files.pythonhosted.org/packages/source/p/%{name}/%{name}-%{version}.tar.gz
7180476
44c3cb4
# Adapt setup.py to prevent an rpath definition in the *.so file
44c3cb4
Patch1: %{name}-build.patch
44c3cb4
e2eee49
# exclude architectures not supported by eccodes
e2eee49
# as explained in bugzilla #1562066
e2eee49
ExcludeArch: i686
e2eee49
# as explained in bugzilla #1562084
e2eee49
ExcludeArch: armv7hl
e2eee49
f4e4b56
# these are required for building pygrib
381ca4f
BuildRequires: gcc
e2eee49
BuildRequires: make
381ca4f
BuildRequires: eccodes-devel
e2eee49
BuildRequires: python3-devel
229f175
BuildRequires: python3-numpy
e2eee49
BuildRequires: python3-Cython
e2eee49
BuildRequires: python3-pyproj
13aa6fb
BuildRequires: python3-setuptools
7180476
13aa6fb
# these are used for pytest testing in the check section
13aa6fb
BuildRequires: python3-pytest
13aa6fb
BuildRequires: python3-pytest-mpl
f4e4b56
BuildRequires: python3-matplotlib
f4e4b56
BuildRequires: python3-cartopy
13aa6fb
BuildRequires: python3-scipy
13aa6fb
13aa6fb
# these are needed to prevent cartopy from downloading shape files
13aa6fb
BuildRequires: natural-earth-map-data-110m
13aa6fb
BuildRequires: natural-earth-map-data-50m
f4e4b56
713ff93
%global _description \
e2eee49
Cython wrapper to provide a high-level interface to the ECMWF eccodes \
536850c
C library for handling GRIB files. \
713ff93
 \
713ff93
GRIB is the the World Meteorological Organization (WMO) standard for \
536850c
distributing gridded data. \
536850c
This module contains python interfaces for reading and modifying GRIB files \
536850c
using the ECMWF ECCODES C library, \
536850c
as well as command-line utilities for listing and re-packing GRIB files. \
536850c
 \
e2eee49
There are for now limited capabilities for writing GRIB files, i.e. \
e2eee49
you can modify the contents of an existing file, \
e2eee49
but you can't create one from scratch.
7180476
713ff93
%description %_description
713ff93
7180476
%package -n python3-%{name}
713ff93
713ff93
Summary: %summary
7180476
068bbf7
# this requirement is not automatically resolved and needs to be
068bbf7
# inserted manually (see bug #996834)
381ca4f
Requires:  eccodes
7470974
Requires:  python3-pyproj
7470974
e2eee49
# ensure python provides are provided
068bbf7
%{?python_provide:%python_provide python3-%{name}}
068bbf7
713ff93
%description -n python3-%{name} %_description
7180476
7180476
%prep
44c3cb4
%autosetup -p1
7180476
7180476
%build
7180476
da9ddb6
%py3_build
7180476
7180476
%install
38c80dd
38c80dd
# this setting triggers installation of man pages by the setup.py file
38c80dd
export MAN_DIR=/usr/share/man/
38c80dd
da9ddb6
%py3_install
7180476
536850c
# copy documentation
536850c
mkdir -p %{buildroot}%{_datadir}/doc/%{name}
536850c
cp -r %{_builddir}/%{name}-%{version}/docs/_build/html \
536850c
      %{buildroot}%{_datadir}/doc/%{name}/html
536850c
536850c
# ensure the autogenerated hidden .buildinfo file is not included
536850c
# since rpmlint does not like hidden files in the documentation
536850c
%{__rm} %{buildroot}%{_datadir}/doc/%{name}/html/.buildinfo
536850c
7180476
%check
068bbf7
13aa6fb
# note: need to do out-of-source-dir testing
13aa6fb
#       otherwise the source pygrib folder is imported
13aa6fb
#       in stead of the copy in the build dir containing the shared object.
7180476
export PYTHONPATH=%{buildroot}/%{python3_sitearch}
f4e4b56
export MPLBACKEND=agg
13aa6fb
13aa6fb
export TESTROOT=%{_builddir}/%{name}-%{version}-tmp-test
13aa6fb
mkdir $TESTROOT
13aa6fb
cp -R sampledata $TESTROOT
13aa6fb
cp -R test $TESTROOT
13aa6fb
13aa6fb
cd  $TESTROOT/test
26b08e8
# check a simple import statement
b8dcb67
%{__python3} -c "import pygrib"
26b08e8
# execute the doc tests as defined in test/test.py
7180476
%{__python3} test.py
26b08e8
26b08e8
# This run script automatically executes all
26b08e8
# tests in the test folder starting with "test_",
26b08e8
# but it only executes the data read functionality of pygrib, and
26b08e8
# does not test generate the test maps by cartopy and does not compare
26b08e8
# those to the reference maps provided.
26b08e8
# That is done by the pytest call below.
f4e4b56
%{__python3} run_tests.py
068bbf7
13aa6fb
# note: pyspharm is not yet available in fedora
13aa6fb
#       this test is automatically skipped when run as python script
44c3cb4
#       but pytest crashes on it so this is just a reminder for now.
13aa6fb
%{__python3} test_spectral.py
13aa6fb
26b08e8
# run the same tests again, but now produce maps using cartopy
26b08e8
# and compare these to reference maps provided with the test suite.
13aa6fb
%pytest test_gaussian.py test_latlons.py \
13aa6fb
        test_lambert.py test_ndfd_conus.py \
26b08e8
        test_ndfd_pr.py \
13aa6fb
        test_rotated_ll.py test_set_bitmap.py  test_stere.py \
13aa6fb
        --mpl --mpl-baseline-path=`pwd`/baseline_images
26b08e8
# Disabled the next 3 since they started to fail after the Fedora 35
26b08e8
# mass-rebuild.
26b08e8
# After inspecting the generated images it is clear that the failures
26b08e8
# are caused by a change in behaviour of cartopy and not related at all
26b08e8
# to the ability of pygrib to read the test files, so for now it seems
26b08e8
# safe to just disable these 3 test cases.
26b08e8
#    test_reduced_gg.py
26b08e8
#    test_reduced_ll.py
26b08e8
#    test_reglatlon.py
26b08e8
# This has been reported here:
26b08e8
# https://github.com/jswhit/pygrib/issues/188
13aa6fb
7180476
%files -n python3-%{name}
f4e4b56
%doc LICENSE PKG-INFO README.md
536850c
%doc %{_datadir}/doc/%{name}/
f4e4b56
%{python3_sitearch}/%{name}
7180476
%{python3_sitearch}/%{name}-*-py*.egg-info
b8e9aa8
%{_bindir}/cnv*
b8e9aa8
%{_bindir}/grib_*
b8e9aa8
%{_mandir}/man1/cnv*
b8e9aa8
%{_mandir}/man1/grib_*
38c80dd
7180476
%changelog
5c0bce6
* Sat Jul 02 2022 Jos de Kloe <josdekloe@gmail.com> 2.1.4-5
5c0bce6
- remove ExcludeArch: s390x, since this is now supported by eccodes
5c0bce6
d030d68
* Wed Jun 29 2022 Python Maint <python-maint@redhat.com> - 2.1.4-4
d030d68
- Rebuilt for Python 3.11
d030d68
26b08e8
* Sun Jan 30 2022 Jos de Kloe <josdekloe@gmail.com> 2.1.4-3
26b08e8
- Disable 3 problematic test cases that fail after the mass rebuild.
26b08e8
c17314d
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.4-2
c17314d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
c17314d
d647f2b
* Sun Sep 19 2021 Jos de Kloe <josdekloe@gmail.com> 2.1.4-1
d647f2b
- Update to 2.1.4 (#2005528)
d647f2b
c847e05
* Thu Sep 09 2021 Jos de Kloe <josdekloe@gmail.com> 2.1.3-6
c847e05
- Fix a zorder problem in the testsuite that was triggered by the move
c847e05
  to matplotlib 3.5.0 in rawhide.
c847e05
9fc3985
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.3-5
9fc3985
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
9fc3985
8b5d362
* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 2.1.3-4
8b5d362
- Rebuilt for Python 3.10
8b5d362
44c3cb4
* Fri Jun 04 2021 Jos de Kloe <josdekloe@gmail.com> 2.1.3-3
44c3cb4
- Fix rpath error as reported by the new check-rpaths tool during rpm build.
44c3cb4
13405bf
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.3-2
13405bf
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
13405bf
13aa6fb
* Sat Dec 26 2020 Jos de Kloe <josdekloe@gmail.com> 2.1.3-1
13aa6fb
- Update to 2.1.3 (#1910130)
13aa6fb
- Activate cartopy based tests run by pytest
13aa6fb
f4e4b56
* Wed Dec 23 2020 Jos de Kloe <josdekloe@gmail.com> 2.1.2-1
f4e4b56
- update to new upstream version 2.1.2
f4e4b56
- activate new set of cartopy based tests
f4e4b56
536850c
* Fri Dec 04 2020 Jos de Kloe <josdekloe@gmail.com> 2.1.1-1
536850c
- update to new upstream version 2.1.1
e2eee49
- general clean-up and remove grib_api workarounds since upstream
e2eee49
  no longer supports grib_api
e2eee49
- remove support for architectures not supported by eccodes
536850c
b8dcb67
* Wed Nov 25 2020 Jos de Kloe <josdekloe@gmail.com> 2.0.5-1
b8dcb67
- update to new upstream version 2.0.5
f2150f1
a0f4988
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 2.0.4-6
a0f4988
- Rebuilt for Python 3.9
a0f4988
b7dd671
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.4-5
b7dd671
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
b7dd671
ee74d8f
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 2.0.4-4
ee74d8f
- Rebuilt for Python 3.8.0rc1 (#1748018)
ee74d8f
9c0351e
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 2.0.4-3
9c0351e
- Rebuilt for Python 3.8
9c0351e
ebad2ed
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.4-2
ebad2ed
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
ebad2ed
229f175
* Sun Mar 24 2019 Jos de Kloe <josdekloe@gmail.com> 2.0.4-1
229f175
- update to new upstream version 2.0.4
229f175
03fb3f0
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.3-3
03fb3f0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
03fb3f0
abafbcf
* Thu Sep 13 2018 Jos de Kloe <josdekloe@gmail.com> 2.0.3-2
abafbcf
- remove python2 sub-package as per Mass Python 2 Package Removal for f30
abafbcf
3d73f64
* Fri Aug 24 2018 Jos de Kloe <josdekloe@gmail.com> 2.0.3-1
3d73f64
- update to new upstream version 2.0.3
3d73f64
1a9ee5e
* Fri Aug 17 2018 Jos de Kloe <josdekloe@gmail.com> 2.0.2-17
1a9ee5e
- merge with cython patch by Miro Hrončok <pagure@pkgs.fedoraproject.org>
1a9ee5e
  (there is no more cython3, use the -m syntax)
1a9ee5e
381ca4f
* Thu Aug 02 2018 Jos de Kloe <josdekloe@gmail.com> - 2.0.2-16
381ca4f
- Build using eccodes for those architectures that provide it
381ca4f
0c4a217
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.2-15
0c4a217
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
0c4a217
2f5f892
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 2.0.2-14
2f5f892
- Rebuilt for Python 3.7
2f5f892
18f7a08
* Thu Feb 15 2018 Jos de Kloe <josdekloe@gmail.com> - 2.0.2-13
18f7a08
- Rebuild after mass rebuild caused dependency troubles
18f7a08
a6e3755
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.2-12
a6e3755
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
a6e3755
e11596e
* Sun Aug 20 2017 Jos de Kloe <josdekloe@gmail.com> 2.0.2-11
e11596e
- Adapt to changed name of g2c static library
e11596e
c0ddfe9
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.2-10
c0ddfe9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
c0ddfe9
6f0f437
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.2-9
6f0f437
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
6f0f437
068bbf7
* Sun Jul 16 2017 Jos de Kloe <josdekloe@gmail.com> 2.0.2-8
068bbf7
- reorganize spec file (following pyproj) example to ensure
068bbf7
  Requires are used for the right sub-package, and added optflags
068bbf7
Igor Gnatenko 0a165d5
* Fri Jul 07 2017 Igor Gnatenko <ignatenko@redhat.com> - 2.0.2-7
Igor Gnatenko 0a165d5
- Rebuild due to bug in RPM (RHBZ #1468476)
Igor Gnatenko 0a165d5
713ff93
* Fri Jun 30 2017 Jos de Kloe <josdekloe@gmail.com> 2.0.2-6
713ff93
- rename pygrib to python2-pygrib following the new package naming scheme
713ff93
648167b
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.2-5
648167b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
648167b
9ec0264
* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 2.0.2-4
9ec0264
- Rebuild for Python 3.6
9ec0264
c1a5bc4
* Sat Dec 3 2016 Jos de Kloe <josdekloe@gmail.com> 2.0.2-3
c1a5bc4
- force a rebuild, needed due to libjasper so version bump
c1a5bc4
7f90d72
* Sat Nov 26 2016 Jos de Kloe <josdekloe@gmail.com> 2.0.2-2
7f90d72
- fix mistake in patch for setup.py file that caused python3 package
7f90d72
  to provide python2 version tools
7f90d72
b8e9aa8
* Sun Nov 20 2016 Jos de Kloe <josdekloe@gmail.com> 2.0.2-1
4dfaf36
- update to new upstream version
b8e9aa8
- provide tools below /usr/bin for python3 in stead of python2
b8e9aa8
- move to new predictable pypi source location
b8e9aa8
- add python_provide macros
b8e9aa8
20f01cd
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.1-3
20f01cd
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
20f01cd
b8d81eb
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.1-2
b8d81eb
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
b8d81eb
5160c61
* Thu Jan 21 2016 Jos de Kloe <josdekloe@gmail.com> 2.0.1-1
5160c61
- update to new upstream version
5160c61
bf7c1db
* Sun Nov 15 2015 Jos de Kloe <josdekloe@gmail.com> 2.0.0-5
bf7c1db
- update patch pygrib-2.0.0-g2clib.pyx.patch and add a new
bf7c1db
  pygrib-2.0.0-pygrib.pyx.patch to adapt to stricter
bf7c1db
  variable type checking of cython
bf7c1db
  
027ede7
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.0-4
027ede7
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5
027ede7
Orion Poplawski 2198239
* Wed Jul 15 2015 Orion Poplawski <orion@cora.nwra.com> - 2.0.0-3
Orion Poplawski 2198239
- Rebuild for grib_api 1.14.0 soname bump
Orion Poplawski 2198239
60b4435
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.0-2
60b4435
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
60b4435
025255e
* Thu Feb 19 2015 Jos de Kloe <josdekloe@gmail.com> 2.0.0-1
025255e
- update to upstream version 2.0.0
025255e
1f725b4
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.9.9-3
1f725b4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
1f725b4
7470974
* Wed Jul 09 2014 Jos de Kloe <josdekloe@gmail.com> 1.9.9-2
7470974
- move requires for python3-pyproj above description section
7470974
38c80dd
* Sat Jul 05 2014 Jos de Kloe <josdekloe@gmail.com> 1.9.9-1
38c80dd
- update to upstream version 1.9.9
38c80dd
- replace python_sitearch macro with python2_sitearch
38c80dd
- activate installation of the newly added man pages
38c80dd
- fix requires problem for python3-pyproj
38c80dd
- update url for Source0
38c80dd
2cb585a
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.9.7-3
2cb585a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
2cb585a
8a6ff0a
* Mon May 19 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 1.9.7-2
8a6ff0a
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4
8a6ff0a
1cc702b
* Sat Oct 26 2013 Jos de Kloe <josdekloe@gmail.com> 1.9.7-1
1cc702b
- update to upstream version 1.9.7
1cc702b
d28fea3
* Fri Aug 23 2013 Jos de Kloe <josdekloe@gmail.com> 1.9.6-1
d28fea3
- update to upstream version 1.9.6
d28fea3
  and move to use grib_api-devel as BR as suggested by Orion Poplawski
1cc702b
  on devel mailinglist on 23-Aug-2013
d28fea3
84cf4da
* Wed Aug 14 2013 Jos de Kloe <josdekloe@gmail.com> 1.9.5-4
84cf4da
- add an explicit requirement on grib_api
84cf4da
5159c7d
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.9.5-3
5159c7d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
5159c7d
7180476
* Thu Nov 22 2012 Jos de Kloe <josdekloe@gmail.com> 1.9.5-2
7180476
- adapt to build with python3 as well
7180476
- fix typo in weekdays in dates of changelog entries 1.9.2-1 and 1.9.4-1
7180476
7180476
* Thu Nov 08 2012 Jos de Kloe <josdekloe@gmail.com> 1.9.5-1
7180476
- update to upstream version 1.9.5
7180476
- add the doc files to the files list
7180476
- activate the check section
7180476
7180476
* Sat Sep 08 2012 Jos de Kloe <josdekloe@gmail.com> 1.9.4-3
7180476
- remove BR of grib_api-devel and g2clib-devel and some textual 
7180476
  changes in the comments
7180476
7180476
* Wed Aug 29 2012 Jos de Kloe <josdekloe@gmail.com> 1.9.4-2
7180476
- address comments 3 and 4 in bugzilla review request 806037
7180476
7180476
* Thu Aug 23 2012 Jos de Kloe <josdekloe@gmail.com> 1.9.4-1
7180476
- move to version 1.9.4 and fix a bunch of rpmlint warnings
7180476
7180476
* Sun Mar 18 2012 Jos de Kloe <josdekloe@gmail.com> 1.9.2-1
7180476
- initial version