[python-hdf5storage] 140/152: Fixed bug on Python 2.6 where sys.version_info is just a tuple unlike in later Python versions.

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Feb 29 08:24:42 UTC 2016


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

ghisvail-guest pushed a commit to annotated tag 0.1
in repository python-hdf5storage.

commit f5b59b5a0955d9892f9f7d0383deaa13eb840fa9
Author: Freja Nordsiek <fnordsie at gmail.com>
Date:   Sun Feb 16 00:42:42 2014 -0500

    Fixed bug on Python 2.6 where sys.version_info is just a tuple unlike in later Python versions.
---
 hdf5storage/__init__.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/hdf5storage/__init__.py b/hdf5storage/__init__.py
index 3ffb9a5..f71d9e0 100644
--- a/hdf5storage/__init__.py
+++ b/hdf5storage/__init__.py
@@ -1011,12 +1011,18 @@ def write(data, path='/', filename='data.h5', truncate_existing=False,
         #     + now.strftime('%a %b %d %H:%M:%S %Y') \
         #     + ' HDF5 schema 1.00 .'
         #
-        # Platform is going to be changed to CPython version
+        # Platform is going to be changed to CPython version. The
+        # version is just gotten from sys.version_info, which is a class
+        # for Python >= 2.7, but a tuple before that.
 
         v = sys.version_info
+        if sys.hexversion >= 0x02070000:
+            v = {'major': v.major, 'minor': v.minor, 'micro': v.micro}
+        else:
+            v = {'major': v[0], 'minor': v[1], 'micro': v[1]}
 
         s = 'MATLAB 7.3 MAT-file, Platform: CPython ' \
-            + '{0}.{1}.{2}'.format(v.major, v.minor, v.micro) \
+            + '{0}.{1}.{2}'.format(v['major'], v['minor'], v['micro']) \
             + ', Created on: ' \
             + now.strftime('%a %b %d %H:%M:%S %Y') \
             + ' HDF5 schema 1.00 .'

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



More information about the debian-science-commits mailing list