[h5py] 94/455: Windows symlink issue

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Thu Jul 2 18:19:21 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 24e8173daec635f859078d71acae98bcb19b8009
Author: andrewcollette <andrew.collette at gmail.com>
Date:   Sun Aug 3 23:39:28 2008 +0000

    Windows symlink issue
---
 MANIFEST.in  |  5 ++++-
 h5py/h5g.pyx | 23 +++++++++++++++++++----
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/MANIFEST.in b/MANIFEST.in
index 21fec11..6beb4ee 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -6,6 +6,9 @@ include CHANGES.txt
 include docs.cfg
 recursive-include h5py *.py *.pyx *.pxd *.pxi *.h *.c *.hdf5
 recursive-include licenses *
-recursive-include docs/html *
+recursive-include docs/manual-html *
+recursive-include docs/api-html *
 include docs/API.html
+include docs/Manual.html
+
 
diff --git a/h5py/h5g.pyx b/h5py/h5g.pyx
index 93f7901..3f560d4 100644
--- a/h5py/h5g.pyx
+++ b/h5py/h5g.pyx
@@ -59,6 +59,17 @@ cdef class GroupStat:
     cdef readonly time_t mtime
     cdef readonly size_t linklen
 
+    def __str__(self):
+        return \
+"""
+fileno %s
+objno %s
+nlink %d
+typecode %d
+mtime %d
+linklen %d
+""" % (self.fileno, self.objno, self.nlink, self.type, self.mtime, self.linklen)
+
 cdef class GroupIter:
 
     """
@@ -88,7 +99,6 @@ cdef class GroupIter:
         self.idx = self.idx + 1
         return retval
 
-
 # === Basic group management ==================================================
 
 def open(ObjectID loc not None, char* name):
@@ -317,6 +327,7 @@ cdef class GroupID(ObjectID):
         """ (STRING name) => STRING link_value
 
             Retrieve the value (target name) of a symbolic link.
+            Limited to 2048 characters on Windows.
         """
         cdef char* value
         cdef H5G_stat_t statbuf
@@ -327,12 +338,16 @@ cdef class GroupID(ObjectID):
         if statbuf.type != H5G_LINK:
             raise ValueError('"%s" is not a symbolic link.' % name)
 
-        value = <char*>emalloc(sizeof(char)*(statbuf.linklen+1))
+        IF UNAME_SYSNAME == "Windows":
+            linklen = 2049  # Windows statbuf.linklen seems broken
+        ELSE:
+            linklen = statbuf.linklen+1
+        value = <char*>emalloc(sizeof(char)*linklen)
         try:
-            H5Gget_linkval(self.id, name, statbuf.linklen+1, value)
+            H5Gget_linkval(self.id, name, linklen, value)
+            value[linklen-1] = c'\0'  # in case HDF5 doesn't null terminate on Windows
             pyvalue = value
             return pyvalue
-
         finally:
             efree(value)
 

-- 
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