version.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. # This file is part of h5py, a Python interface to the HDF5 library.
  2. #
  3. # http://www.h5py.org
  4. #
  5. # Copyright 2008-2013 Andrew Collette and contributors
  6. #
  7. # License: Standard 3-clause BSD; see "license.txt" for full license terms
  8. # and contributor agreement.
  9. """
  10. Versioning module for h5py.
  11. """
  12. from collections import namedtuple
  13. from . import h5 as _h5
  14. import sys
  15. import numpy
  16. # All should be integers, except pre, as validating versions is more than is
  17. # needed for our use case
  18. _H5PY_VERSION_CLS = namedtuple("_H5PY_VERSION_CLS",
  19. "major minor bugfix pre post dev")
  20. hdf5_built_version_tuple = _h5.HDF5_VERSION_COMPILED_AGAINST
  21. version_tuple = _H5PY_VERSION_CLS(3, 3, 0, None, None, None)
  22. version = "{0.major:d}.{0.minor:d}.{0.bugfix:d}".format(version_tuple)
  23. if version_tuple.pre is not None:
  24. version += version_tuple.pre
  25. if version_tuple.post is not None:
  26. version += ".post{0.post:d}".format(version_tuple)
  27. if version_tuple.dev is not None:
  28. version += ".dev{0.dev:d}".format(version_tuple)
  29. hdf5_version_tuple = _h5.get_libversion()
  30. hdf5_version = "%d.%d.%d" % hdf5_version_tuple
  31. api_version_tuple = (1,8)
  32. api_version = "%d.%d" % api_version_tuple
  33. info = """\
  34. Summary of the h5py configuration
  35. ---------------------------------
  36. h5py %(h5py)s
  37. HDF5 %(hdf5)s
  38. Python %(python)s
  39. sys.platform %(platform)s
  40. sys.maxsize %(maxsize)s
  41. numpy %(numpy)s
  42. cython (built with) %(cython_version)s
  43. numpy (built against) %(numpy_build_version)s
  44. HDF5 (built against) %(hdf5_build_version)s
  45. """ % {
  46. 'h5py': version,
  47. 'hdf5': hdf5_version,
  48. 'python': sys.version,
  49. 'platform': sys.platform,
  50. 'maxsize': sys.maxsize,
  51. 'numpy': numpy.__version__,
  52. 'cython_version': _h5.CYTHON_VERSION_COMPILED_WITH,
  53. 'numpy_build_version': _h5.NUMPY_VERSION_COMPILED_AGAINST,
  54. 'hdf5_build_version': "%d.%d.%d" % hdf5_built_version_tuple,
  55. }