[Git][debian-gis-team/netcdf4-python][upstream] New upstream version 1.5.5

Bas Couwenberg gitlab at salsa.debian.org
Mon Dec 7 04:57:45 GMT 2020



Bas Couwenberg pushed to branch upstream at Debian GIS Project / netcdf4-python


Commits:
55ffe800 by Bas Couwenberg at 2020-12-07T05:46:00+01:00
New upstream version 1.5.5
- - - - -


7 changed files:

- − COPYING
- Changelog
- + LICENSE
- README.md
- docs/netCDF4/index.html
- netCDF4/_netCDF4.pyx
- setup.py


Changes:

=====================================
COPYING deleted
=====================================
@@ -1,27 +0,0 @@
-copyright: 2008 by Jeffrey Whitaker.
-
-Permission to use, copy, modify, and distribute this software and
-its documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both the copyright notice and this permission notice appear in
-supporting documentation.
-
-THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
-EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR
-CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
-USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
-OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-PERFORMANCE OF THIS SOFTWARE.
-
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


=====================================
Changelog
=====================================
@@ -1,3 +1,10 @@
+ version 1.5.5 (tag v1.5.5rel)
+==============================
+ * have setup.py always try use nc-config first to find paths to netcdf and
+ hdf5 libraries and headers. Don't use pkg-config to find HDF5 if HDF5 env
+ vars are set (or read from setup.cfg).
+ * Change MIT license text to standard OSI wording (PR #1046).
+
  version 1.5.4 (tag v1.5.4rel)
 ==============================
  * fix printing of variable objects for variables that end with the letter 'u'


=====================================
LICENSE
=====================================
@@ -0,0 +1,7 @@
+Copyright 2008 Jeffrey Whitaker
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


=====================================
README.md
=====================================
@@ -10,6 +10,8 @@
 ## News
 For details on the latest updates, see the [Changelog](https://github.com/Unidata/netcdf4-python/blob/master/Changelog).
 
+12/01/2020: Version [1.5.5](https://pypi.python.org/pypi/netCDF4/1.5.5) released]. Update license wording to be consistent with MIT license. 
+
 07/23/2020: Version [1.5.4](https://pypi.python.org/pypi/netCDF4/1.5.4) released]. Now requires 
 numpy >= 1.9.
  


=====================================
docs/netCDF4/index.html
=====================================
@@ -4,7 +4,7 @@
   <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
 
     <title>netCDF4 API documentation</title>
-    <meta name="description" content="Version 1.5.4
+    <meta name="description" content="Version 1.5.5
 ---------------
 - - -
 
@@ -1282,7 +1282,7 @@ table {
 
   <header id="section-intro">
   <h1 class="title"><span class="name">netCDF4</span> module</h1>
-  <h2>Version 1.5.4</h2>
+  <h2>Version 1.5.5</h2>
 <hr />
 <h1>Introduction</h1>
 <p>netcdf4-python is a Python interface to the netCDF C library.</p>
@@ -1347,25 +1347,24 @@ types) are not supported.</p>
  easiest if all the C libs are built as shared libraries.</li>
 <li>By default, the utility <code>nc-config</code>, installed with netcdf 4.1.2 or higher,
  will be run used to determine where all the dependencies live.</li>
-<li>If <code>nc-config</code> is not in your default <code>$PATH</code>
- edit the <code>setup.cfg</code> file
+<li>If <code>nc-config</code> is not in your default <code>PATH</code>, you can set the <code>NETCDF4_DIR</code>
+ environment variable and <code>setup.py</code> will look in <code>$NETCDF4_DIR/bin</code>.
+ You can also use the file <code>setup.cfg</code> to set the path to <code>nc-config</code>, or
+ enter the paths to the libraries and include files manually. Just  edit the <code>setup.cfg</code> file
  in a text editor and follow the instructions in the comments.
- In addition to specifying the path to <code>nc-config</code>,
- you can manually set the paths to all the libraries and their include files
- (in case <code>nc-config</code> does not do the right thing).</li>
-<li>run <code>python setup.py build</code>, then <code>python setup.py install</code> (as root if
- necessary).</li>
-<li><a href="https://pip.pypa.io/en/latest/reference/pip_install.html"><code>pip install</code></a> can
- also be used, with library paths set with environment variables. To make
- this work, the <code>USE_SETUPCFG</code> environment variable must be used to tell
- setup.py not to use <code>setup.cfg</code>.
- For example, <code>USE_SETUPCFG=0 HDF5_INCDIR=/usr/include/hdf5/serial
- HDF5_LIBDIR=/usr/lib/x86_64-linux-gnu/hdf5/serial pip install</code> has been
- shown to work on an Ubuntu/Debian linux system. Similarly, environment variables
+ To disable the use of <code>nc-config</code>, set the env var <code>USE_NCCONFIG</code> to 0.
+ To disable the use of <code>setup.cfg</code>, set <code>USE_SETUPCFG</code> to 0.
+ As a last resort, the library and include paths can be set via environment variables.
+ If you go this route, set <code>USE_NCCONFIG</code> and <code>USE_SETUPCFG</code> to 0, and specify
+ <code>NETCDF4_LIBDIR</code>, <code>NETCDF4_INCDIR</code>, <code>HDF5_LIBDIR</code> and <code>HDF5_INCDIR</code>.
+ Similarly, environment variables
  (all capitalized) can be used to set the include and library paths for
- <code>hdf5</code>, <code>netCDF4</code>, <code>hdf4</code>, <code>szip</code>, <code>jpeg</code>, <code>curl</code> and <code>zlib</code>. If the
- libraries are installed in standard places (e.g. <code>/usr</code> or <code>/usr/local</code>),
- the environment variables do not need to be set.</li>
+ <code>hdf4</code>, <code>szip</code>, <code>jpeg</code>, <code>curl</code> and <code>zlib</code>. If the dependencies are not found
+ in any of the paths specified by environment variables, then standard locations
+ (such as <code>/usr</code> and <code>/usr/local</code>) are searched.</li>
+<li>run <code>python setup.py build</code>, then <code>python setup.py install</code> (as root if
+ necessary). <code>pip install</code> can be used to install pre-compiled binary wheels from 
+ <a href="https://pypi.org/project/netCDF4">pypi</a>.</li>
 <li>run the tests in the 'test' directory by running <code>python run_all.py</code>.</li>
 </ul>
 <h1>Tutorial</h1>
@@ -2450,23 +2449,23 @@ returned.</p>
   
     <div class="desc"><p>date2index(dates, nctime, calendar=None, select='exact')</p>
 <p>Return indices of a netCDF time variable corresponding to the given dates.</p>
-<p><strong><code>dates</code></strong>: A datetime object or a sequence of datetime objects.
+<p><strong>dates</strong>: A datetime object or a sequence of datetime objects.
 The datetime objects should not include a time-zone offset.</p>
-<p><strong><code>nctime</code></strong>: A netCDF time variable object. The nctime object must have a
-<code>units</code> attribute.</p>
-<p><strong><code>calendar</code></strong>: describes the calendar used in the time calculations.
+<p><strong>nctime</strong>: A netCDF time variable object. The nctime object must have a
+<strong>units</strong> attribute.</p>
+<p><strong>calendar</strong>: describes the calendar used in the time calculations.
 All the values currently defined in the
 <a href="http://cfconventions.org">CF metadata convention</a>
-Valid calendars <code>'standard', 'gregorian', 'proleptic_gregorian'
-'noleap', '365_day', '360_day', 'julian', 'all_leap', '366_day'</code>.
-Default is <code>'standard'</code>, which is a mixed Julian/Gregorian calendar.
-If <code>calendar</code> is None, its value is given by <code>nctime.calendar</code> or
-<code>standard</code> if no such attribute exists.</p>
-<p><strong><code>select</code></strong>: <code>'exact', 'before', 'after', 'nearest'</code>
-The index selection method. <code>exact</code> will return the indices perfectly
-matching the dates given. <code>before</code> and <code>after</code> will return the indices
+Valid calendars <strong>'standard', 'gregorian', 'proleptic_gregorian'
+'noleap', '365_day', '360_day', 'julian', 'all_leap', '366_day'</strong>..
+Default is <strong>'standard'</strong>, which is a mixed Julian/Gregorian calendar.
+If <strong>calendar</strong> is None, its value is given by <strong>nctime.calendar</strong> or
+<strong>standard</strong> if no such attribute exists.</p>
+<p><strong>select</strong>: <strong>'exact', 'before', 'after', 'nearest'</strong>
+The index selection method. <strong>exact</strong> will return the indices perfectly
+matching the dates given. <strong>before</strong> and <strong>after</strong> will return the indices
 corresponding to the dates just before or just after the given dates if
-an exact match cannot be found. <code>nearest</code> will return the indices that
+an exact match cannot be found. <strong>nearest</strong> will return the indices that
 correspond to the closest dates.</p>
 <p>returns an index (indices) of the netCDF time variable corresponding
 to the given datetime object(s).</p></div>
@@ -2484,27 +2483,30 @@ to the given datetime object(s).</p></div>
 
     
   
-    <div class="desc"><p>date2num(dates,units,calendar='standard')</p>
+    <div class="desc"><p>date2num(dates, units, calendar=None)</p>
 <p>Return numeric time values given datetime objects. The units
-of the numeric time values are described by the <code>units</code> argument
-and the <code>calendar</code> keyword. The datetime objects must
+of the numeric time values are described by the <strong>units</strong> argument
+and the <strong>calendar</strong> keyword. The datetime objects must
 be in UTC with no time-zone offset.  If there is a
-time-zone offset in <code>units</code>, it will be applied to the
+time-zone offset in <strong>units</strong>, it will be applied to the
 returned numeric values.</p>
-<p><strong><code>dates</code></strong>: A datetime object or a sequence of datetime objects.
-The datetime objects should not include a time-zone offset.</p>
-<p><strong><code>units</code></strong>: a string of the form <code><time units> since <reference time></code>
-describing the time units. <code><time units></code> can be days, hours, minutes,
-seconds, milliseconds or microseconds. <code><reference time></code> is the time
-origin. <code>months_since</code> is allowed <em>only</em> for the <code>360_day</code> calendar.</p>
-<p><strong><code>calendar</code></strong>: describes the calendar used in the time calculations.
+<p><strong>dates</strong>: A datetime object or a sequence of datetime objects.
+The datetime objects should not include a time-zone offset. They
+can be either native python datetime instances (which use
+the proleptic gregorian calendar) or cftime.datetime instances.</p>
+<p><strong>units</strong>: a string of the form <strong><time units> since <reference time></strong>
+describing the time units. <strong><time units></strong> can be days, hours, minutes,
+seconds, milliseconds or microseconds. <strong><reference time></strong> is the time
+origin. <strong>months_since</strong> is allowed <em>only</em> for the <strong>360_day</strong> calendar.</p>
+<p><strong>calendar</strong>: describes the calendar to be used in the time calculations.
 All the values currently defined in the
 <a href="http://cfconventions.org">CF metadata convention</a>
-Valid calendars <code>'standard', 'gregorian', 'proleptic_gregorian'
-'noleap', '365_day', '360_day', 'julian', 'all_leap', '366_day'</code>.
-Default is <code>'standard'</code>, which is a mixed Julian/Gregorian calendar.</p>
+Valid calendars <strong>'standard', 'gregorian', 'proleptic_gregorian'
+'noleap', '365_day', '360_day', 'julian', 'all_leap', '366_day'</strong>..
+Default is <code>None</code> which means the calendar associated with the rist
+input datetime instance will be used.</p>
 <p>returns a numeric time value, or an array of numeric time values
-with approximately 100 microsecond accuracy.</p></div>
+with approximately 1 microsecond accuracy.</p></div>
   <div class="source_cont">
 </div>
 
@@ -2552,41 +2554,41 @@ used to build the module, and when it was built.</p></div>
 
     
   
-    <div class="desc"><p>num2date(times,units,calendar='standard',only_use_cftime_datetimes=True,only_use_python_datetimes=False)</p>
+    <div class="desc"><p>num2date(times, units, calendar='standard', only_use_cftime_datetimes=True, only_use_python_datetimes=False)</p>
 <p>Return datetime objects given numeric time values. The units
-of the numeric time values are described by the <code>units</code> argument
-and the <code>calendar</code> keyword. The returned datetime objects represent
+of the numeric time values are described by the <strong>units</strong> argument
+and the <strong>calendar</strong> keyword. The returned datetime objects represent
 UTC with no time-zone offset, even if the specified
-<code>units</code> contain a time-zone offset.</p>
-<p><strong><code>times</code></strong>: numeric time values.</p>
-<p><strong><code>units</code></strong>: a string of the form <code><time units> since <reference time></code>
-describing the time units. <code><time units></code> can be days, hours, minutes,
-seconds, milliseconds or microseconds. <code><reference time></code> is the time
-origin. <code>months_since</code> is allowed <em>only</em> for the <code>360_day</code> calendar.</p>
-<p><strong><code>calendar</code></strong>: describes the calendar used in the time calculations.
+<strong>units</strong> contain a time-zone offset.</p>
+<p><strong>times</strong>: numeric time values.</p>
+<p><strong>units</strong>: a string of the form <strong><time units> since <reference time></strong>
+describing the time units. <strong><time units></strong> can be days, hours, minutes,
+seconds, milliseconds or microseconds. <strong><reference time></strong> is the time
+origin. <strong>months_since</strong> is allowed <em>only</em> for the <strong>360_day</strong> calendar.</p>
+<p><strong>calendar</strong>: describes the calendar used in the time calculations.
 All the values currently defined in the
 <a href="http://cfconventions.org">CF metadata convention</a>
-Valid calendars <code>'standard', 'gregorian', 'proleptic_gregorian'
-'noleap', '365_day', '360_day', 'julian', 'all_leap', '366_day'</code>.
-Default is <code>'standard'</code>, which is a mixed Julian/Gregorian calendar.</p>
-<p><strong><code>only_use_cftime_datetimes</code></strong>: if False, python datetime.datetime
+Valid calendars <strong>'standard', 'gregorian', 'proleptic_gregorian'
+'noleap', '365_day', '360_day', 'julian', 'all_leap', '366_day'</strong>..
+Default is <strong>'standard'</strong>, which is a mixed Julian/Gregorian calendar.</p>
+<p><strong>only_use_cftime_datetimes</strong>: if False, python datetime.datetime
 objects are returned from num2date where possible; if True dates which
-subclass cftime.datetime are returned for all calendars. Default <code>True</code>.</p>
-<p><strong><code>only_use_python_datetimes</code></strong>: always return python datetime.datetime
+subclass cftime.datetime are returned for all calendars. Default <strong>True</strong>.</p>
+<p><strong>only_use_python_datetimes</strong>: always return python datetime.datetime
 objects and raise an error if this is not possible. Ignored unless
-<code>only_use_cftime_datetimes=False</code>. Default <code>False</code>.</p>
+<strong>only_use_cftime_datetimes=False</strong>. Default <strong>False</strong>.</p>
 <p>returns a datetime instance, or an array of datetime instances with
-approximately 100 microsecond accuracy.</p>
+microsecond accuracy, if possible.</p>
 <p><strong><em>Note</em></strong>: If only_use_cftime_datetimes=False and
 use_only_python_datetimes=False, the datetime instances
 returned are 'real' python datetime
-objects if <code>calendar='proleptic_gregorian'</code>, or
-<code>calendar='standard'</code> or <code>'gregorian'</code>
+objects if <strong>calendar='proleptic_gregorian'</strong>, or
+<strong>calendar='standard'</strong> or <strong>'gregorian'</strong>
 and the date is after the breakpoint between the Julian and
 Gregorian calendars (1582-10-15). Otherwise, they are ctime.datetime
 objects which support some but not all the methods of native python
 datetime objects. The datetime instances
-do not contain a time-zone offset, even if the specified <code>units</code>
+do not contain a time-zone offset, even if the specified <strong>units</strong>
 contains one.</p></div>
   <div class="source_cont">
 </div>
@@ -6629,7 +6631,7 @@ slower than multiple calls to the unstrided read routine <code>nc_get_vara</code
   <footer id="footer">
     <p>
       Documentation generated by
-      <a href="https://github.com/BurntSushi/pdoc">pdoc 0.3.2.dev30</a>
+      <a href="https://github.com/BurntSushi/pdoc">pdoc 0.3.2.dev29+dirty</a>
     </p>
 
     <p>pdoc is in the public domain with the


=====================================
netCDF4/_netCDF4.pyx
=====================================
@@ -1,5 +1,5 @@
 """
-Version 1.5.4
+Version 1.5.5
 ---------------
 - - -
 
@@ -75,25 +75,24 @@ Install
  easiest if all the C libs are built as shared libraries.
  - By default, the utility `nc-config`, installed with netcdf 4.1.2 or higher,
  will be run used to determine where all the dependencies live.
- - If `nc-config` is not in your default `$PATH`
- edit the `setup.cfg` file
+ - If `nc-config` is not in your default `PATH`, you can set the `NETCDF4_DIR`
+ environment variable and `setup.py` will look in `$NETCDF4_DIR/bin`.
+ You can also use the file `setup.cfg` to set the path to `nc-config`, or
+ enter the paths to the libraries and include files manually. Just  edit the `setup.cfg` file
  in a text editor and follow the instructions in the comments.
- In addition to specifying the path to `nc-config`,
- you can manually set the paths to all the libraries and their include files
- (in case `nc-config` does not do the right thing).
- - run `python setup.py build`, then `python setup.py install` (as root if
- necessary).
- - [`pip install`](https://pip.pypa.io/en/latest/reference/pip_install.html) can
- also be used, with library paths set with environment variables. To make
- this work, the `USE_SETUPCFG` environment variable must be used to tell
- setup.py not to use `setup.cfg`.
- For example, `USE_SETUPCFG=0 HDF5_INCDIR=/usr/include/hdf5/serial
- HDF5_LIBDIR=/usr/lib/x86_64-linux-gnu/hdf5/serial pip install` has been
- shown to work on an Ubuntu/Debian linux system. Similarly, environment variables
+ To disable the use of `nc-config`, set the env var `USE_NCCONFIG` to 0.
+ To disable the use of `setup.cfg`, set `USE_SETUPCFG` to 0.
+ As a last resort, the library and include paths can be set via environment variables.
+ If you go this route, set `USE_NCCONFIG` and `USE_SETUPCFG` to 0, and specify
+ `NETCDF4_LIBDIR`, `NETCDF4_INCDIR`, `HDF5_LIBDIR` and `HDF5_INCDIR`.
+ Similarly, environment variables
  (all capitalized) can be used to set the include and library paths for
- `hdf5`, `netCDF4`, `hdf4`, `szip`, `jpeg`, `curl` and `zlib`. If the
- libraries are installed in standard places (e.g. `/usr` or `/usr/local`),
- the environment variables do not need to be set.
+ `hdf4`, `szip`, `jpeg`, `curl` and `zlib`. If the dependencies are not found
+ in any of the paths specified by environment variables, then standard locations
+ (such as `/usr` and `/usr/local`) are searched.
+ - run `python setup.py build`, then `python setup.py install` (as root if
+ necessary). `pip install` can be used to install pre-compiled binary wheels from 
+ [pypi](https://pypi.org/project/netCDF4).
  - run the tests in the 'test' directory by running `python run_all.py`.
 
 Tutorial
@@ -1205,7 +1204,7 @@ except ImportError:
     # python3: zip is already python2's itertools.izip
     pass
 
-__version__ = "1.5.4"
+__version__ = "1.5.5"
 
 # Initialize numpy
 import posixpath


=====================================
setup.py
=====================================
@@ -36,6 +36,18 @@ def check_hdf5version(hdf5_includedir):
             hdf5_version = line.split('"')[1]
     return hdf5_version
 
+def get_hdf5_version(direc):
+    # check to see if hdf5 headers in direc, return version number or None
+    hdf5_version = None
+    sys.stdout.write('checking %s ...\n' % direc)
+    hdf5_version = check_hdf5version(direc)
+    if hdf5_version is None:
+        sys.stdout.write('hdf5 headers not found in %s\n' % direc)
+        return None
+    else:
+        sys.stdout.write('%s headers found in %s\n' %
+                        (hdf5_version,direc))
+        return hdf5_version
 
 def check_ifnetcdf4(netcdf4_includedir):
     try:
@@ -187,8 +199,7 @@ else:
 
 setup_cfg = 'setup.cfg'
 # contents of setup.cfg will override env vars, unless
-# USE_SETUPCFG evaluates to True. Exception is use_ncconfig,
-# which does not take precedence ofver USE_NCCONFIG env var.
+# USE_SETUPCFG evaluates to False. 
 ncconfig = None
 use_ncconfig = None
 if USE_SETUPCFG and os.path.exists(setup_cfg):
@@ -280,27 +291,26 @@ if USE_SETUPCFG and os.path.exists(setup_cfg):
     except:
         pass
 
-# make sure USE_NCCONFIG from environment takes
-# precendence over use_ncconfig from setup.cfg (issue #341).
-if USE_NCCONFIG is None and use_ncconfig is not None:
-    USE_NCCONFIG = use_ncconfig
-elif USE_NCCONFIG is None:
-    USE_NCCONFIG = False
-
-# if USE_NCCONFIG set, and nc-config works, use it.
-if USE_NCCONFIG:
-    # if NETCDF4_DIR env var is set, look for nc-config in NETCDF4_DIR/bin.
+try:
     if ncconfig is None:
         if netCDF4_dir is not None:
             ncconfig = os.path.join(netCDF4_dir, 'bin/nc-config')
         else:  # otherwise, just hope it's in the users PATH.
             ncconfig = 'nc-config'
-    try:
-        retcode = subprocess.call([ncconfig, '--libs'], stdout=subprocess.PIPE)
-    except:
-        retcode = 1
-else:
-    retcode = 1
+    HAS_NCCONFIG = subprocess.call([ncconfig, '--libs'],
+                                     stdout=subprocess.PIPE) == 0
+except OSError:
+    HAS_NCCONFIG = False
+
+# make sure USE_NCCONFIG from environment takes
+# precendence over use_ncconfig from setup.cfg (issue #341).
+if USE_NCCONFIG is None and use_ncconfig is not None:
+    USE_NCCONFIG = use_ncconfig
+elif USE_NCCONFIG is None:
+    # if nc-config exists, and USE_NCCONFIG not set, try to use it.
+    if HAS_NCCONFIG: USE_NCCONFIG=True
+#elif USE_NCCONFIG is None: 
+#    USE_NCCONFIG = False # don't try to use nc-config if USE_NCCONFIG not set
 
 try:
     HAS_PKG_CONFIG = subprocess.call(['pkg-config', '--libs', 'hdf5'],
@@ -311,7 +321,9 @@ except OSError:
 def _populate_hdf5_info(dirstosearch, inc_dirs, libs, lib_dirs):
     global HDF5_incdir, HDF5_dir, HDF5_libdir
 
-    if HAS_PKG_CONFIG:
+    nohdf5dirs = HDF5_incdir is None and HDF5_libdir is None and  HDF5_dir is None
+    if HAS_PKG_CONFIG and nohdf5dirs:
+        # if HDF5 dirs not specified, and pkg-config available, use it
         dep = subprocess.Popen(['pkg-config', '--cflags', 'hdf5'],
                                stdout=subprocess.PIPE).communicate()[0]
         inc_dirs.extend([str(i[2:].decode()) for i in dep.split() if
@@ -331,8 +343,7 @@ def _populate_hdf5_info(dirstosearch, inc_dirs, libs, lib_dirs):
             sys.stdout.write("""
     HDF5_DIR environment variable not set, checking some standard locations ..\n""")
             for direc in dirstosearch:
-                sys.stdout.write('checking %s ...\n' % direc)
-                hdf5_version = check_hdf5version(os.path.join(direc, 'include'))
+                hdf5_version = get_hdf5_version(os.path.join(direc, 'include'))
                 if hdf5_version is None:
                     continue
                 else:
@@ -346,7 +357,7 @@ def _populate_hdf5_info(dirstosearch, inc_dirs, libs, lib_dirs):
         else:
             if HDF5_incdir is None:
                 HDF5_incdir = os.path.join(HDF5_dir, 'include')
-            hdf5_version = check_hdf5version(HDF5_incdir)
+            hdf5_version = get_hdf5_version(HDF5_incdir)
             if hdf5_version is None:
                 raise ValueError('did not find HDF5 headers in %s' % HDF5_incdir)
             else:
@@ -365,8 +376,9 @@ def _populate_hdf5_info(dirstosearch, inc_dirs, libs, lib_dirs):
 dirstosearch = [os.path.expanduser('~'), '/usr/local', '/sw', '/opt',
                 '/opt/local', '/usr']
 
-if not retcode:  # Try nc-config.
-    sys.stdout.write('using nc-config ...\n')
+# try nc-config first
+if USE_NCCONFIG and HAS_NCCONFIG:  # Try nc-config.
+    sys.stdout.write('using %s...\n' % ncconfig)
     dep = subprocess.Popen([ncconfig, '--libs'],
                            stdout=subprocess.PIPE).communicate()[0]
     libs = [str(l[2:].decode()) for l in dep.split() if l[0:2].decode() == '-l']
@@ -377,23 +389,25 @@ if not retcode:  # Try nc-config.
     inc_dirs = [str(i[2:].decode()) for i in dep.split() if
                 i[0:2].decode() == '-I']
 
-    _populate_hdf5_info(dirstosearch, inc_dirs, libs, lib_dirs)
-elif HAS_PKG_CONFIG:  # Try pkg-config.
-    sys.stdout.write('using pkg-config ...\n')
-    dep = subprocess.Popen(['pkg-config', '--libs', 'netcdf'],
-                           stdout=subprocess.PIPE).communicate()[0]
-    libs = [str(l[2:].decode()) for l in dep.split() if l[0:2].decode() == '-l']
-    lib_dirs = [str(l[2:].decode()) for l in dep.split() if
-                l[0:2].decode() == '-L']
-
-    inc_dirs = []
-    _populate_hdf5_info(dirstosearch, inc_dirs, libs, lib_dirs)
-# If nc-config and pkg-config both didn't work (it won't on Windows), fall back on brute force method.
+    # check to see if hdf5 found in directories returned by nc-config
+    hdf5_version = None
+    for direc in inc_dirs:
+        hdf5_version = get_hdf5_version(direc)
+        if hdf5_version is not None:
+            break
+    # if hdf5 not found, search other standard locations (including those specified in env vars).
+    if hdf5_version is None:
+        sys.stdout.write('nc-config did provide path to HDF5 headers, search standard locations...')
+        _populate_hdf5_info(dirstosearch, inc_dirs, libs, lib_dirs)
+
+# If nc-config doesn't work, fall back on brute force method.
 else:
     lib_dirs = []
     inc_dirs = []
     libs = []
 
+    # _populate_hdf5_info will use HDF5_dir, HDF5_libdir and HDF5_incdir if they are set.
+    # otherwise pkg-config will be tried, and if that fails, dirstosearch will be searched.
     _populate_hdf5_info(dirstosearch, inc_dirs, libs, lib_dirs)
 
     if netCDF4_incdir is None and netCDF4_dir is None:
@@ -596,14 +610,14 @@ else:
 
 setup(name="netCDF4",
       cmdclass=cmdclass,
-      version="1.5.4",
+      version="1.5.5",
       long_description="netCDF version 4 has many features not found in earlier versions of the library, such as hierarchical groups, zlib compression, multiple unlimited dimensions, and new data types.  It is implemented on top of HDF5.  This module implements most of the new features, and can read and write netCDF files compatible with older versions of the library.  The API is modelled after Scientific.IO.NetCDF, and should be familiar to users of that module.\n\nThis project is hosted on a `GitHub repository <https://github.com/Unidata/netcdf4-python>`_ where you may access the most up-to-date source.",
       author="Jeff Whitaker",
       author_email="jeffrey.s.whitaker at noaa.gov",
       url="http://github.com/Unidata/netcdf4-python",
       download_url="http://python.org/pypi/netCDF4",
       platforms=["any"],
-      license="OSI Approved",
+      license='License :: OSI Approved :: MIT License',
       description="Provides an object-oriented python interface to the netCDF version 4 library.",
       keywords=['numpy', 'netcdf', 'data', 'science', 'network', 'oceanography',
                 'meteorology', 'climate'],
@@ -613,7 +627,7 @@ setup(name="netCDF4",
                    "Programming Language :: Python :: 3.7",
                    "Programming Language :: Python :: 3.8",
                    "Intended Audience :: Science/Research",
-                   "License :: OSI Approved",
+                   "License :: OSI Approved :: MIT License",
                    "Topic :: Software Development :: Libraries :: Python Modules",
                    "Topic :: System :: Archiving :: Compression",
                    "Operating System :: OS Independent"],



View it on GitLab: https://salsa.debian.org/debian-gis-team/netcdf4-python/-/commit/55ffe800b2e00c463c6ae81146a858ff94d182ce

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/netcdf4-python/-/commit/55ffe800b2e00c463c6ae81146a858ff94d182ce
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20201207/7a7a6832/attachment-0001.html>


More information about the Pkg-grass-devel mailing list