summaryrefslogtreecommitdiffstats
path: root/src/H5Tconv.c
Commit message (Expand)AuthorAgeFilesLines
...
* | [svn-r15682] Purpose: fix bug 1298Neil Fortner2008-09-221-23/+33
* | [svn-r15628] Description:Quincey Koziol2008-09-161-21/+21
* | [svn-r15609] Description:Quincey Koziol2008-09-101-1021/+1086
* | [svn-r15485] Purpose: Allow library to shut down properly when objects have r...Neil Fortner2008-08-191-10/+10
|/
* [svn-r14903] Undoing change committed in r14902.Scot Breitenfeld2008-04-301-4/+2
* [svn-r14902] Merged fortran_1_8 branch changes r14505:14901 into the trunk. N...Scot Breitenfeld2008-04-301-2/+4
* [svn-r14860] Description:Quincey Koziol2008-04-241-4/+2
* [svn-r14187] Description:Quincey Koziol2007-10-041-1/+1
* [svn-r14144] Description:Quincey Koziol2007-09-131-1/+1
* [svn-r14015] Refactoring part of the code. Tested only on liberty becauseRaymond Lu2007-07-251-24/+1
* [svn-r14011] Refactored part of the code in H5T_conv_struct_opt. Tested only Raymond Lu2007-07-241-28/+19
* [svn-r14003] Description:Quincey Koziol2007-07-241-8/+6
* [svn-r13926] Description:Quincey Koziol2007-06-291-8/+9
* [svn-r13885] Modify the comment from the checkin last round.Raymond Lu2007-06-191-3/+3
* [svn-r13884] The second step of optimization for compound data for the ChicagoRaymond Lu2007-06-191-31/+127
* [svn-r13841] Description:Quincey Koziol2007-06-081-2/+2
* [svn-r13803] Optimization of reading compound data.Raymond Lu2007-05-231-59/+139
* [svn-r13544] Some minor adjustment from last round of checkin. Tested on kagisoRaymond Lu2007-03-261-4/+3
* [svn-r13542] Added a detection for zero-length VL data in H5T_conv_vlen to ha...Raymond Lu2007-03-261-1/+7
* [svn-r13348] Minor change - a void pointer wasn't cast to a byte pointer.Raymond Lu2007-02-201-1/+1
* [svn-r13342] Bug fix (#717): Nested VL data failed to free the space when the...Raymond Lu2007-02-201-4/+4
* [svn-r13253] Updated all C and C++ style source code files with the THG copyr...Albert Cheng2007-02-071-2/+3
* [svn-r12828] Description:Quincey Koziol2006-10-301-39/+39
* [svn-r12821] Description:Quincey Koziol2006-10-281-28/+28
* [svn-r12803] Description:Quincey Koziol2006-10-231-1/+1
* [svn-r12736] Description:Quincey Koziol2006-10-091-38/+31
* [svn-r12706] Description:Quincey Koziol2006-10-021-29/+27
* [svn-r12680] Description:Quincey Koziol2006-09-251-1/+1
* [svn-r12440] Purpose:Quincey Koziol2006-06-271-21/+21
* [svn-r12435] Purpose: Bug fixRaymond Lu2006-06-231-2/+2
* [svn-r12107] Purpose: Minor changeRaymond Lu2006-03-161-3/+3
* [svn-r12091] Purpose: Support for VAX floating-point types.Raymond Lu2006-03-141-19/+103
* [svn-r11966] Purpose:Quincey Koziol2006-02-271-8/+8
* [svn-r11712] Purpose:Quincey Koziol2005-11-151-2/+4
* [svn-r11424] Purpose:Quincey Koziol2005-09-171-233/+255
* [svn-r11415] Purpose: Internal design change.Raymond Lu2005-09-141-3/+3
* [svn-r11395] Purpose: Bug fixRaymond Lu2005-09-121-238/+235
* [svn-r11346] Purpose:Quincey Koziol2005-09-031-413/+466
* [svn-r11345] Purpose:Quincey Koziol2005-09-031-53/+114
* [svn-r11332] Purpose: Minor Change to Macro NamesRaymond Lu2005-09-011-68/+68
* [svn-r11317] Purpose: Minor change to macro namesRaymond Lu2005-08-301-67/+67
* [svn-r11311] Purpose: New features.Raymond Lu2005-08-291-75/+127
* [svn-r11254] Purpose: Bug fixRaymond Lu2005-08-171-3/+3
* [svn-r11245] Purpose:Quincey Koziol2005-08-131-326/+326
* [svn-r11233] Purpose: Bug fixRaymond Lu2005-08-111-1/+1
* [svn-r11144] Purpose:Quincey Koziol2005-07-231-2/+67
* [svn-r11001] Purpose: Add more comment.Raymond Lu2005-06-291-1/+2
* [svn-r10998] Purpose: Bug fix.Raymond Lu2005-06-291-1/+9
* [svn-r10919] Purpose: Take Out An Unused FunctionRaymond Lu2005-06-141-391/+0
* [svn-r10918] Purpose: Bug fixRaymond Lu2005-06-141-2/+2
ug_print("global-exclude " + ' '.join(patterns)) for pattern in patterns: if not self.exclude_pattern(pattern, anchor=0): log.warn(("warning: no previously-included files matching " "'%s' found anywhere in distribution"), pattern) elif action == 'recursive-include': self.debug_print("recursive-include %s %s" % (dir, ' '.join(patterns))) for pattern in patterns: if not self.include_pattern(pattern, prefix=dir): log.warn(("warning: no files found matching '%s' " "under directory '%s'"), pattern, dir) elif action == 'recursive-exclude': self.debug_print("recursive-exclude %s %s" % (dir, ' '.join(patterns))) for pattern in patterns: if not self.exclude_pattern(pattern, prefix=dir): log.warn(("warning: no previously-included files matching " "'%s' found under directory '%s'"), pattern, dir) elif action == 'graft': self.debug_print("graft " + dir_pattern) if not self.include_pattern(None, prefix=dir_pattern): log.warn("warning: no directories found matching '%s'", dir_pattern) elif action == 'prune': self.debug_print("prune " + dir_pattern) if not self.exclude_pattern(None, prefix=dir_pattern): log.warn(("no previously-included directories found " "matching '%s'"), dir_pattern) else: raise DistutilsInternalError( "this cannot happen: invalid action '%s'" % action) # -- Filtering/selection methods ----------------------------------- def include_pattern(self, pattern, anchor=1, prefix=None, is_regex=0): """Select strings (presumably filenames) from 'self.files' that match 'pattern', a Unix-style wildcard (glob) pattern. Patterns are not quite the same as implemented by the 'fnmatch' module: '*' and '?' match non-special characters, where "special" is platform- dependent: slash on Unix; colon, slash, and backslash on DOS/Windows; and colon on Mac OS. If 'anchor' is true (the default), then the pattern match is more stringent: "*.py" will match "foo.py" but not "foo/bar.py". If 'anchor' is false, both of these will match. If 'prefix' is supplied, then only filenames starting with 'prefix' (itself a pattern) and ending with 'pattern', with anything in between them, will match. 'anchor' is ignored in this case. If 'is_regex' is true, 'anchor' and 'prefix' are ignored, and 'pattern' is assumed to be either a string containing a regex or a regex object -- no translation is done, the regex is just compiled and used as-is. Selected strings will be added to self.files. Return True if files are found, False otherwise. """ files_found = False pattern_re = translate_pattern(pattern, anchor, prefix, is_regex) self.debug_print("include_pattern: applying regex r'%s'" % pattern_re.pattern) # delayed loading of allfiles list if self.allfiles is None: self.findall() for name in self.allfiles: if pattern_re.search(name): self.debug_print(" adding " + name) self.files.append(name) files_found = True return files_found def exclude_pattern (self, pattern, anchor=1, prefix=None, is_regex=0): """Remove strings (presumably filenames) from 'files' that match 'pattern'. Other parameters are the same as for 'include_pattern()', above. The list 'self.files' is modified in place. Return True if files are found, False otherwise. """ files_found = False pattern_re = translate_pattern(pattern, anchor, prefix, is_regex) self.debug_print("exclude_pattern: applying regex r'%s'" % pattern_re.pattern) for i in range(len(self.files)-1, -1, -1): if pattern_re.search(self.files[i]): self.debug_print(" removing " + self.files[i]) del self.files[i] files_found = True return files_found # ---------------------------------------------------------------------- # Utility functions def findall(dir=os.curdir): """Find all files under 'dir' and return the list of full filenames (relative to 'dir'). """ from stat import ST_MODE, S_ISREG, S_ISDIR, S_ISLNK list = [] stack = [dir] pop = stack.pop push = stack.append while stack: dir = pop() names = os.listdir(dir) for name in names: if dir != os.curdir: # avoid the dreaded "./" syndrome fullname = os.path.join(dir, name) else: fullname = name # Avoid excess stat calls -- just one will do, thank you! stat = os.stat(fullname) mode = stat[ST_MODE] if S_ISREG(mode): list.append(fullname) elif S_ISDIR(mode) and not S_ISLNK(mode): push(fullname) return list def glob_to_re(pattern): """Translate a shell-like glob pattern to a regular expression; return a string containing the regex. Differs from 'fnmatch.translate()' in that '*' does not match "special characters" (which are platform-specific). """ pattern_re = fnmatch.translate(pattern) # '?' and '*' in the glob pattern become '.' and '.*' in the RE, which # IMHO is wrong -- '?' and '*' aren't supposed to match slash in Unix, # and by extension they shouldn't match such "special characters" under # any OS. So change all non-escaped dots in the RE to match any # character except the special characters. # XXX currently the "special characters" are just slash -- i.e. this is # Unix-only. pattern_re = re.sub(r'((?<!\\)(\\\\)*)\.', r'\1[^/]', pattern_re) return pattern_re def translate_pattern(pattern, anchor=1, prefix=None, is_regex=0): """Translate a shell-like wildcard pattern to a compiled regular expression. Return the compiled regex. If 'is_regex' true, then 'pattern' is directly compiled to a regex (if it's a string) or just returned as-is (assumes it's a regex object). """ if is_regex: if isinstance(pattern, str): return re.compile(pattern) else: return pattern if pattern: pattern_re = glob_to_re(pattern) else: pattern_re = '' if prefix is not None: # ditch end of pattern character empty_pattern = glob_to_re('') prefix_re = (glob_to_re(prefix))[:-len(empty_pattern)] pattern_re = "^" + os.path.join(prefix_re, ".*" + pattern_re) else: # no prefix -- respect anchor flag if anchor: pattern_re = "^" + pattern_re return re.compile(pattern_re)