[h5py] 160/455: Remove ObjectID crasher, update install guide, enhance logging

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Thu Jul 2 18:19:28 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to annotated tag 1.3.0
in repository h5py.

commit fdadc58123bc9134e1f8a08ef715678c5548b109
Author: andrewcollette <andrew.collette at gmail.com>
Date:   Mon Nov 24 02:43:16 2008 +0000

    Remove ObjectID crasher, update install guide, enhance logging
---
 MANIFEST.in                 |   5 --
 autotest.py                 |  36 -----------
 docs.cfg                    |   8 ---
 docs/source/guide/build.rst | 147 ++++++++++++++++----------------------------
 docs/source/guide/hl.rst    |   6 ++
 docs/source/guide/quick.rst |  10 +--
 h5py/_extras.py             |  26 ++++++--
 h5py/h5.pyx                 |   8 +--
 8 files changed, 85 insertions(+), 161 deletions(-)

diff --git a/MANIFEST.in b/MANIFEST.in
index 4721e64..cb088fe 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -6,8 +6,3 @@ include CHANGES.txt
 include docs.cfg
 recursive-include h5py *.py *.pyx *.pxd *.pxi *.h *.c *.hdf5
 recursive-include licenses *
-recursive-include docs/manual-html *
-recursive-include docs/api-html *
-include docs/Manual.html
-include docs/API.html
-
diff --git a/autotest.py b/autotest.py
deleted file mode 100644
index 2c2a4f4..0000000
--- a/autotest.py
+++ /dev/null
@@ -1,36 +0,0 @@
-# Development script to test setup options
-import os.path as op
-import os, sys
-
-# HDF5 library versions
-libnames = ['h167','h180','h181']
-lib_base = op.abspath(op.join(op.curdir, '..'))
-libs = [''] + [' --hdf5='+op.join(lib_base, x) for x in libnames]
-
-# Experimental non-blocking I/O
-nonblock = ['']
-
-# API versions
-api = [' --api=16', ' --api=18']
-
-linebase = "python setup.py test --pyrex-force%s%s%s"
-print libs
-print nonblock
-print api
-
-idx=0
-for l in libs:
-    for n in nonblock:
-        for a in api:
-                # Only allow --api=18 if 1.8.X library being tested
-                if '8' in a and not '8' in l:
-                    continue
-                line = linebase % (l, n, a)
-                outfile = "autotest%d.txt" % idx
-                print 'Testing config %d "%s"...' % (idx, line)
-                retval = os.system(line+" > %s 2>&1" % outfile)
-                if retval !=0:
-                    print '!!! Line failed; output saved to "%s"' % outfile
-                else:
-                    os.unlink(outfile)
-                idx += 1
diff --git a/docs.cfg b/docs.cfg
deleted file mode 100644
index 2f7e14d..0000000
--- a/docs.cfg
+++ /dev/null
@@ -1,8 +0,0 @@
-[epydoc]
-
-name: h5py HDF5 interface for Python
-url: http://h5py.alfven.org
-link: <a href="http://h5py.alfven.org">h5py Project Page at Alfven.org</a>
-docformat: plaintext
-private: no
-
diff --git a/docs/source/guide/build.rst b/docs/source/guide/build.rst
index 8850943..94a178f 100644
--- a/docs/source/guide/build.rst
+++ b/docs/source/guide/build.rst
@@ -2,26 +2,60 @@
 Installation guide
 ******************
 
-Installing on Linux/Mac OS-X
-============================
+Where to get h5py
+=================
 
-This package is designed to be installed from source.  You will need
-Python and a C compiler, for distutils to build the extensions.  Pyrex_ is
-required only if you want to change compile-time options, like the
-debugging level.
+See the download page at `the Google Code site`__.  If installing on Windows,
+be sure to get a version that matches your Python version (2.5 or 2.6).
+
+__ http://h5py.googlecode.com
 
 Getting HDF5
-------------
+============
+
+On :ref:`Windows <windows>`, HDF5 is provided as part of the integrated
+installer for h5py.  On UNIX platforms (:ref:`Linux and OS-X <linux>`), you
+must provide HDF5 yourself.  The following HDF5 versions are supported:
+
+* 1.6.5, 1.6.7, 1.6.8, 1.8.0, 1.8.1, 1.8.2
+
+**The best solution is to install HDF5 via a package manager.** If you must
+install yourself from source, keep in mind that you *must* build as a dynamic
+library.
 
-HDF5 versions 1.6.5 and later are supported, including 1.8.X.  Since h5py
-consists of multiple modules, HDF5 *must* be available as a dynamic library.
-**The best solution is to install HDF5 via a package manager.**
 `The HDF Group`__ provides several "dumb" (untar in "/") binary distributions
 for Linux, but traditionally only static libraries for Mac.  Mac OS-X users
 should use something like Fink, or compile HDF5 from source.
 
 __ http://www.hdfgroup.com/HDF5
 
+
+.. _windows:
+
+Installing on Windows
+=====================
+
+Download the executable installer from `Google Code`__ and run it.  This
+installs h5py and a private copy of HDF5 1.8.
+
+__ http://h5py.googlecode.com
+
+Requires
+--------
+
+- NumPy_ 1.0.3 or higher
+
+.. _linux:
+
+Installing on Linux/Mac OS-X
+============================
+
+This package is designed to be installed from source.  You will need
+Python and a C compiler, for distutils to build the extensions.  Cython_ is
+required only if you want to change compile-time options, like the
+debugging level.
+
+
 Requires
 --------
 - Unix-like environment (created/tested on 32-bit Intel linux)
@@ -29,11 +63,11 @@ Requires
 - Numpy_ 1.0.3 or higher
 - HDF5_ 1.6.5 or higher, including 1.8.X versions
 - A working compiler for distutils
-- (Optionally) Pyrex_ 0.9.8.4 or higher
+- (Optionally) Cython_ 0.9.8.1.1 or higher
 
 .. _Numpy: http://numpy.scipy.org/
 .. _HDF5: http://www.hdfgroup.com/HDF5
-.. _Pyrex: http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/
+.. _Cython: http://cython.org/
 
 Procedure
 ---------
@@ -50,92 +84,19 @@ Additional options
 
 ::
 
- --pyrex         Have Pyrex recompile changed pyx files.
- --pyrex-only    Have Pyrex recompile changed pyx files, and stop.
- --pyrex-force   Recompile all pyx files, regardless of timestamps.
- --no-pyrex      Don't run Pyrex, no matter what
-
- --hdf5=path     Use alternate HDF5 directory (containing bin, include, lib)
-
- --api=<n>       Specifies API version.  The 1.8.X API (--api=18) is a
-                 work in progress.
-
- --debug=<n>     If nonzero, compile in debug mode.  The number is
-                 interpreted as a logging-module level number.  Requires
-                 Pyrex for recompilation.
-
- --io-nonblock   Enable experimental non-blocking I/O feature.  The GIL will
-                 be released around lengthy HDF5 reads/writes.  See the
-                 "Threading" manual entry for caveats.
-
-
-Installing on Windows
-=====================
-
-**It's strongly recommended that you use the pre-built .exe installer.**  It
-will install h5py, a private copy of HDF5 1.8.1 with ZLIB and (optionally)
-SZIP compression enabled, and the proper C runtime dependencies.  You must have
-the following already installed:
-
-- Python 2.5
-- Numpy_ 1.0.3 or higher
-
-If for some reason you want to build from source (for example, to change the
-compile-time options), read the following instructions carefully.
-
-Environment for source build
-----------------------------
-
-1. Install Python 2.5 and Numpy 1.0.3 or higher
-2. Install MinGW to ``C:\MinGW``
-3. Add ``C:\MinGW\bin`` to the Windows PATH
-4. Download the ``pexports`` utility and place it in ``C:\MinGW\bin``
-5. Go to ``C:\Python25\Lib\distutils`` (or equivalent path for your Python install)
-   and create the file "distutils.cfg" with the following text::
-
-    [build]
-    compiler=mingw32
-
-6. Add ``C:\Python25`` (or wherever python.exe lives) to your Windows PATH
-
-Get HDF5 and create import file
--------------------------------
-
-1. Download the pre-built version of HDF5 1.8.1, along with SZIP and ZLIB.
-   You should use the versions built with Visual Studio 2005.  Make sure you
-   get the version of SZIP with compression enabled.
-2. Unpack the HDF5 archive to e.g. ``C:\hdf5``; this directory should now
-   contain ``include`` and ``dll``, among other things.
-3. Open a command prompt in ``C:\hdf5\dll`` and run
-   ``pexports hdf5dll.dll > hdf5dll.def``
-4. Run ``dlltool -D hdf5dll.dll -d hdf5dll.def -l hdf5dll.dll.a``
-5. Create the directory ``C:\hdf5\dll2`` and move ``hdf5dll.dll.a`` there
-
-Compile h5py
-------------
-
-1. Download h5py and extract it to ``C:\h5py``.
-2. In ``C:\h5py``, run ``python setup.py build --hdf5=C:\hdf5``
-3. Copy the following files to ``C:\h5py\h5py``:
-
-    * hdf5dll.dll (from ``C:\hdf5\dll``)
-    * zlib1.dll (from the HDF group zlib archive)
-    * szipdll.dll (from the HDF group szip archive)
+ --hdf5=<path>   Path to your HDF5 installation (if not in one of the standard
+                 places.  Must contain bin/ and lib/ directories.
 
-4. Run unit tests via ``python setup.py test --hdf5=C:\hdf5``
+ --cython        Force Cython to run
 
-.. note::
+ --cython-only   Run Cython, and stop before compiling with GCC.
+ 
+ --api=<16|18>   Force either 1.6 or 1.8 API compatibility level.  Use if h5py
+                 does not correctly identify your installed HDF5 version.
 
-    If you get the message "DLL import failed: configuration incorrect" or
-    some variant, you need to install the package
-    "Microsoft Visual C++ 2005 SP1 Redistributable" from Microsoft's
-    web site.  This is because the pre-compiled HDF5 library requires
-    a specific C runtime library distributed with Visual Studio.
+ --diag=<int>    Compile in diagnostic (debug) mode.
 
-5. Install via ``python setup.py install --hdf5=C:\hdf5``.
 
-After you're done, you can delete the ``C:\hdf5`` and ``C:\h5py`` directories.
-They aren't needed at runtime.
 
 
 
diff --git a/docs/source/guide/hl.rst b/docs/source/guide/hl.rst
index 28f554b..f4cbe06 100644
--- a/docs/source/guide/hl.rst
+++ b/docs/source/guide/hl.rst
@@ -1,4 +1,6 @@
 
+.. _h5pyreference:
+
 *************
 Documentation
 *************
@@ -546,6 +548,10 @@ Resizing
         >>> dset.shape
         (20, 35)
 
+    Resizing an array with existing data works differently than in NumPy; if
+    any axis shrinks, the data in the missing region is discarded.  Data does
+    not "rearrange" itself as it does when resizing a NumPy array.
+
     .. note::
         Only datasets stored in "chunked" format can be resized.  This format
         is automatically selected when any of the advanced storage options is
diff --git a/docs/source/guide/quick.rst b/docs/source/guide/quick.rst
index 17b9e1c..5b06cc3 100644
--- a/docs/source/guide/quick.rst
+++ b/docs/source/guide/quick.rst
@@ -228,14 +228,10 @@ in any dataset, this is the right way to do it.
 More information
 ================
 
-Everything in h5py is documented with docstrings.  The `online HTML
-documentation`__ provides a cross-referenced document with this information.
-The classes described in this document are stored in the ``h5py.highlevel``
-module.
+See the :ref:`reference chapter <h5pyreference>` for complete documentation of
+high-level interface objects like Groups and Datasets.
 
-__ http://h5py.alfven.org/docs/
-
-The `HDF Group`__ website is the final authority on HDF5.  Their `user
+The `HDF Group`__ is the final authority on HDF5.  Their `user
 manual`__ is a great introduction to the basic concepts of HDF5, albeit from
 the perspective of a C programmer.
 
diff --git a/h5py/_extras.py b/h5py/_extras.py
index 5df3626..f4224c3 100644
--- a/h5py/_extras.py
+++ b/h5py/_extras.py
@@ -24,6 +24,18 @@ def uw_apply(wrap, func):
     else:
         update_wrapper(wrap, func, assigned=('__name__','__doc__'))
 
+def funcname(func):
+
+    if hasattr(func, '__module__') and func.__module__ is not None:
+        fullname = "%s.%s" % (func.__module__, func.__name__)
+    elif hasattr(func, '__self__'):
+        fullname = "%s.%s" % (func.__self__.__class__.__name__, func.__name__)
+    else:
+        fullname = func.__name__
+
+    return fullname
+
+
 def h5sync(logger=None):
 
     if logger is None:
@@ -41,15 +53,17 @@ def h5sync(logger=None):
 
         def sync_debug(func):
 
+            fname = funcname(func)
+
             def wrap(*args, **kwds):
-                logger.debug("$ Threadsafe function entry: %s" % func.__name__)
+                logger.debug( ("[ Call %s\n%s\n%s" % (fname, args, kwds)).replace("\n", "\n  ") )
                 try:
                     with phil:
                         retval = func(*args, **kwds)
-                except:
-                    logger.debug("! Exception in %s" % func.__name__)
+                except Exception, e:
+                    logger.debug('! Exception in %s: %s("%s")' % (fname, e.__class__.__name__, e))
                     raise
-                logger.debug("# Threadsafe function exit: %s" % func.__name__)
+                logger.debug( ("] Exit %s\n%s" % (fname,retval)).replace("\n", "\n  ") )
                 return retval
 
             uw_apply(wrap, func)
@@ -62,13 +76,13 @@ def h5sync_dummy(logger):
     def log_only(func):
 
         def wrap(*args, **kwds):
-            logger.debug("$ Function entry: %s" % func.__name__)
+            logger.debug("[ Function entry: %s" % func.__name__)
             try:
                 retval = func(*args, **kwds)
             except:
                 logger.debug("! Exception in %s" % func.__name__)
                 raise
-            logger.debug("# Function exit: %s" % func.__name__)
+            logger.debug("] Function exit: %s" % func.__name__)
             return retval
         uw_apply(wrap, func)
         return wrap
diff --git a/h5py/h5.pyx b/h5py/h5.pyx
index 5f2d09e..cb8a543 100644
--- a/h5py/h5.pyx
+++ b/h5py/h5.pyx
@@ -182,13 +182,9 @@ cdef class PHIL:
             return 0
         cpdef bint acquire(self, int blocking=1) except -1:
             cdef bint rval = self.lock.acquire(blocking)
-            IF H5PY_DEBUG:
-                log_threads.debug('> PHIL acquired')
             return rval
         cpdef bint release(self) except -1:
             self.lock.release()
-            IF H5PY_DEBUG:
-                log_threads.debug('< PHIL released')
             return 0
     ELSE:
         cpdef bint __enter__(self) except -1:
@@ -266,8 +262,8 @@ cdef class ObjectID:
         phil.acquire()
         try:
             IF H5PY_DEBUG:
-                log_ident.debug("- %s" % str(self))
-            if (not self._locked) and self._valid:
+                log_ident.debug("- %d" % self.id)
+            if (not self._locked) and H5Iget_type(self.id) != H5I_BADID:
                 H5Idec_ref(self.id)
         finally:
             phil.release()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/h5py.git



More information about the debian-science-commits mailing list