From 5f8715c8b4270ddf45ff208f6a227fce9eac146c Mon Sep 17 00:00:00 2001 From: Andrey Kamaev Date: Thu, 5 Jul 2012 05:11:15 +0000 Subject: [PATCH] Fixed file globbing in documentation parsers --- doc/check_docs2.py | 10 ++++++---- modules/java/generator/rst_parser.py | 9 +++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/doc/check_docs2.py b/doc/check_docs2.py index 12696b36c0..59e980eaf9 100644 --- a/doc/check_docs2.py +++ b/doc/check_docs2.py @@ -1,7 +1,7 @@ -import os, sys, glob, re +import os, sys, fnmatch, re sys.path.append("../modules/python/src2/") -sys.path.append("../modules/java/") +sys.path.append("../modules/java/generator") import hdr_parser as hp import rst_parser as rp @@ -185,8 +185,10 @@ def process_module(module, path): rstparser.parse(module, path) rst = rstparser.definitions - hdrlist = glob.glob(os.path.join(path, "include", "opencv2", module, "*.h*")) - hdrlist.extend(glob.glob(os.path.join(path, "include", "opencv2", module, "detail", "*.h*"))) + hdrlist = [] + for root, dirs, files in os.walk(os.path.join(path, "include")): + for filename in fnmatch.filter(files, "*.h*"): + hdrlist.append(os.path.join(root, filename)) if module == "gpu": hdrlist.append(os.path.join(path, "..", "core", "include", "opencv2", "core", "devmem2d.hpp")) diff --git a/modules/java/generator/rst_parser.py b/modules/java/generator/rst_parser.py index 6781f07914..0b788b35fb 100644 --- a/modules/java/generator/rst_parser.py +++ b/modules/java/generator/rst_parser.py @@ -1,4 +1,4 @@ -import os, sys, re, string, glob +import os, sys, re, string, fnmatch allmodules = ["core", "flann", "imgproc", "ml", "highgui", "video", "features2d", "calib3d", "objdetect", "legacy", "contrib", "gpu", "androidcamera", "java", "python", "stitching", "ts", "photo", "nonfree", "videostab"] verbose = False show_warnings = True @@ -125,7 +125,12 @@ class RstParser(object): def parse(self, module_name, module_path=None): if module_path is None: module_path = "../" + module_name - doclist = glob.glob(os.path.join(module_path,"doc/*.rst")) + + doclist = [] + for root, dirs, files in os.walk(os.path.join(module_path,"doc")): + for filename in fnmatch.filter(files, "*.rst"): + doclist.append(os.path.join(root, filename)) + for doc in doclist: self.parse_rst_file(module_name, doc)