diff --git a/.gitignore b/.gitignore index 78633f5..a15de1b 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ /netcdf4-python-1.1.3.tar.gz /netcdf4-python-1.1.4.tar.gz /netcdf4-python-1.1.6.tar.gz +/netcdf4-python-1.2.2.tar.gz diff --git a/netcdf4-python-libs.patch b/netcdf4-python-libs.patch index af5e64a..d1df95d 100644 --- a/netcdf4-python-libs.patch +++ b/netcdf4-python-libs.patch @@ -1,14 +1,12 @@ -diff -up netcdf4-python-92c0a1ca62b22d4173622122226c060de3c063c6/setup.py.libs netcdf4-python-92c0a1ca62b22d4173622122226c060de3c063c6/setup.py ---- netcdf4-python-92c0a1ca62b22d4173622122226c060de3c063c6/setup.py.libs 2014-05-09 15:26:35.080367287 -0600 -+++ netcdf4-python-92c0a1ca62b22d4173622122226c060de3c063c6/setup.py 2014-05-09 15:27:31.109059089 -0600 -@@ -243,8 +243,8 @@ NETCDF4_DIR environment variable not set - if netCDF4_libdir is None and netCDF4_dir is not None: - netCDF4_libdir = os.path.join(netCDF4_dir, 'lib') - -- libs = ['netcdf','hdf5_hl','hdf5','z'] -- lib_dirs = [netCDF4_libdir,HDF5_libdir] -+ libs = ['netcdf'] -+ lib_dirs = [netCDF4_libdir] - inc_dirs = [netCDF4_incdir,HDF5_incdir] - - # add szip to link if desired. +diff -up netcdf4-python-1.2.2rel/setup.py.libs netcdf4-python-1.2.2rel/setup.py +--- netcdf4-python-1.2.2rel/setup.py.libs 2016-02-05 08:33:54.977139095 -0700 ++++ netcdf4-python-1.2.2rel/setup.py 2016-02-05 08:35:07.630694784 -0700 +@@ -307,7 +307,7 @@ NETCDF4_DIR environment variable not set + if sys.platform=='win32': + libs = ['netcdf','hdf5_hl','hdf5','zlib'] + else: +- libs = ['netcdf','hdf5_hl','hdf5','z'] ++ libs = ['netcdf'] + if netCDF4_libdir is not None: lib_dirs=[netCDF4_libdir] + if HDF5_libdir is not None: lib_dirs.append(HDF5_libdir) + if netCDF4_incdir is not None: inc_dirs=[netCDF4_incdir] diff --git a/netcdf4-python-norpath.patch b/netcdf4-python-norpath.patch index 5d451bd..9613d4e 100644 --- a/netcdf4-python-norpath.patch +++ b/netcdf4-python-norpath.patch @@ -1,21 +1,23 @@ -diff -up netcdf4-python-1.1.4rel/setup.py.norpath netcdf4-python-1.1.4rel/setup.py ---- netcdf4-python-1.1.4rel/setup.py.norpath 2015-02-19 19:37:30.000000000 -0700 -+++ netcdf4-python-1.1.4rel/setup.py 2015-02-21 20:07:31.075705534 -0700 -@@ -313,7 +313,7 @@ else: - if has_cython and 'sdist' not in sys.argv[1:]: - sys.stdout.write('using Cython to compile netCDF4.pyx...\n') - # recompile netCDF4.pyx -- extensions = [Extension("netCDF4",["netCDF4.pyx"],libraries=libs,library_dirs=lib_dirs,include_dirs=inc_dirs,runtime_library_dirs=lib_dirs), -+ extensions = [Extension("netCDF4",["netCDF4.pyx"],libraries=libs,library_dirs=lib_dirs,include_dirs=inc_dirs), +diff -up netcdf4-python-1.2.2rel/setup.py.norpath netcdf4-python-1.2.2rel/setup.py +--- netcdf4-python-1.2.2rel/setup.py.norpath 2016-02-05 08:32:27.626630007 -0700 ++++ netcdf4-python-1.2.2rel/setup.py 2016-02-05 08:33:33.808264087 -0700 +@@ -382,8 +382,7 @@ if has_cython and 'sdist' not in sys.arg + [netcdf4_src_root + '.pyx'], + libraries=libs, + library_dirs=lib_dirs, +- include_dirs=inc_dirs, +- runtime_library_dirs=runtime_lib_dirs), ++ include_dirs=inc_dirs), Extension('netcdftime._datetime', ['netcdftime/_datetime.pyx'])] # remove netCDF4.c file if it exists, so cython will recompile netCDF4.pyx. # run for build *and* install (issue #263). Otherwise 'pip install' will -@@ -345,7 +345,7 @@ if has_cython and 'sdist' not in sys.arg - cmdclass = {'build_ext': build_ext} - else: - # use existing netCDF4.c, don't need cython. -- extensions = [Extension("netCDF4",["netCDF4.c"],libraries=libs,library_dirs=lib_dirs,include_dirs=inc_dirs,runtime_library_dirs=lib_dirs), -+ extensions = [Extension("netCDF4",["netCDF4.c"],libraries=libs,library_dirs=lib_dirs,include_dirs=inc_dirs), +@@ -425,8 +424,7 @@ else: + [netcdf4_src_c], + libraries=libs, + library_dirs=lib_dirs, +- include_dirs=inc_dirs, +- runtime_library_dirs=runtime_lib_dirs), ++ include_dirs=inc_dirs), Extension('netcdftime._datetime', ['netcdftime/_datetime.c'])] - cmdclass = {} + ext_modules = extensions diff --git a/netcdf4-python-numpy1.11.patch b/netcdf4-python-numpy1.11.patch new file mode 100644 index 0000000..29f64d6 --- /dev/null +++ b/netcdf4-python-numpy1.11.patch @@ -0,0 +1,40 @@ +diff -up netcdf4-python-1.2.2rel/Changelog.numpy1.11 netcdf4-python-1.2.2rel/Changelog +diff -up netcdf4-python-1.2.2rel/test/tst_masked.py.numpy1.11 netcdf4-python-1.2.2rel/test/tst_masked.py +--- netcdf4-python-1.2.2rel/test/tst_masked.py.numpy1.11 2015-12-31 09:07:06.000000000 -0700 ++++ netcdf4-python-1.2.2rel/test/tst_masked.py 2016-02-05 16:44:44.341533935 -0700 +@@ -28,7 +28,8 @@ ranarr[::2] = missing_value + ranarr2[::2] = missing_value2 + NP.seterr(invalid='ignore') # silence warnings from ma.masked_values + maskedarr = ma.masked_values(ranarr,missing_value) +-maskedarr2 = ma.masked_values(ranarr2,missing_value2) ++#maskedarr2 = ma.masked_values(ranarr2,missing_value2) ++maskedarr2 = ma.masked_invalid(ranarr2) + scale_factor = (packeddata.max()-packeddata.min())/(2.*32766.) + add_offset = 0.5*(packeddata.max()+packeddata.min()) + packeddata2 = NP.around((packeddata-add_offset)/scale_factor).astype('i2') +diff --git a/test/tst_multifile.py b/test/tst_multifile.py +index 3e4c1dc..ffe5106 100644 +--- a/test/tst_multifile.py ++++ b/test/tst_multifile.py +@@ -29,7 +29,7 @@ def setUp(self): + dat = f.createVariable('data','i',('x','y','z',)) + dat.long_name = 'phony data' + dat.missing_value = missval +- nx1 = nfile*ninc; nx2 = ninc*(nfile+1) ++ nx1 = int(nfile*ninc); nx2 = int(ninc*(nfile+1)) + #x[0:ninc] = np.arange(nfile*ninc,ninc*(nfile+1)) + x[:] = np.arange(nfile*ninc,ninc*(nfile+1)) + #dat[0:ninc] = data[nx1:nx2] +diff --git a/test/tst_multifile2.py b/test/tst_multifile2.py +index 0a59013..34b21a1 100644 +--- a/test/tst_multifile2.py ++++ b/test/tst_multifile2.py +@@ -30,7 +30,7 @@ def setUp(self): + dat = f.createVariable('data','i',('x','y','z',)) + dat.long_name = 'phony data' + dat.missing_value = missval +- nx1 = nfile*ninc; nx2 = ninc*(nfile+1) ++ nx1 = int(nfile*ninc); nx2 = int(ninc*(nfile+1)) + #x[0:ninc] = np.arange(nfile*ninc,ninc*(nfile+1)) + x[:] = np.arange(nfile*ninc,ninc*(nfile+1)) + #dat[0:ninc] = data[nx1:nx2] diff --git a/netcdf4-python.spec b/netcdf4-python.spec index 46d91b1..0978a14 100644 --- a/netcdf4-python.spec +++ b/netcdf4-python.spec @@ -7,8 +7,8 @@ %global srcname distribute Name: netcdf4-python -Version: 1.1.6 -Release: 5%{?dist} +Version: 1.2.2 +Release: 1%{?dist} Summary: Python/numpy interface to netCDF Group: Development/Languages @@ -21,6 +21,9 @@ Patch0: netcdf4-python-norpath.patch # Don't link against hdf5 and z libraries # http://code.google.com/p/netcdf4-python/issues/detail?id=139 Patch1: netcdf4-python-libs.patch +# Upstream fix for numpy 1.11 +# https://github.com/Unidata/netcdf4-python/commit/c6fe43007510d5130de06bf9083c2bfcd45fc6c3.patch +Patch2: netcdf4-python-numpy1.11.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: python2-devel @@ -97,49 +100,36 @@ containing vlens, and vlens containing compound types) are not supported. %setup -q -n %{name}-%{version}rel %patch0 -p1 -b .norpath %patch1 -p1 -b .libs +%patch2 -p1 -b .numpy1.11 # This uses the network rm test/tst_dap.py -%if 0%{?with_python3} -rm -rf %{py3dir} -cp -a . %{py3dir} -find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|' -%endif # with_python3 - -find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python}|' - %build -CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build +%py2_build %if 0%{?with_python3} -pushd %{py3dir} -CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build -popd +%py3_build %endif # with_python3 %install -rm -rf $RPM_BUILD_ROOT # Must do the python3 install first because the scripts in /usr/bin are # overwritten with every setup.py install (and we want the python2 version # to be the default for now). %if 0%{?with_python3} -pushd %{py3dir} -%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT +%py3_install rm $RPM_BUILD_ROOT%{_bindir}/* -popd %endif # with_python3 -%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT +%py2_install %check cd test -PYTHONPATH=$(echo ../build/lib.*) python run_all.py +PYTHONPATH=$(echo ../build/lib.*%{python2_version}) %{__python2} run_all.py %if 0%{?with_python3} -cd %{py3dir}/test -PYTHONPATH=$(echo ../build/lib.*) python3 run_all.py +PYTHONPATH=$(echo ../build/lib.*%{python3_version}) %{__python3} run_all.py %endif @@ -158,6 +148,11 @@ PYTHONPATH=$(echo ../build/lib.*) python3 run_all.py %changelog +* Sun Feb 7 2016 Orion Poplawski - 1.2.2-1 +- Update to 1.2.2 +- Modernize spec +- Add upstream patch for numpy support + * Thu Feb 04 2016 Fedora Release Engineering - 1.1.6-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild diff --git a/sources b/sources index a78fd9a..5ab70c1 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -d54669d962c95a15b6d789adf65afd2c netcdf4-python-1.1.6.tar.gz +c3e2d276f1b45fa28635a0d35d0f36ee netcdf4-python-1.2.2.tar.gz