def main(): """ Call SumatraPDF View, try to synchronize line number """ def notepad(afile, linenum): realpath = os.path.abspath(afile) scmd = ''.join([ r'C:\app\docstruct\npp\notepad++.exe', ' -n', str(linenum), ' ', ' "', realpath, '" ' ]) # os.system(scmd) subprocess.Popen(scmd) def inkscape(afile): realpath = os.path.abspath(afile) scmd = ''.join( [r'C:\app\docstruct\inkscape\inkscape.exe', ' "', realpath, '" ']) os.system(scmd) realpath = os.path.abspath(sys.argv[1]) linenum = sys.argv[2] deps_analyzer = dependency_analyzer.DependencyAnalyzer() files = deps_analyzer.get_all_files(realpath) if len(files) > 1: for afile in files[:-1]: pathname, ext = os.path.splitext(afile) if ext in ['.py', '.tex']: notepad(afile, 0) if ext in ['.svg']: inkscape(afile) notepad(realpath, linenum)
def __init__(self, filename, namespaces=(), classes=(), namespace_to_factor=(), appname='', modulename='', moduledoc='', use_properties=False, members_read_only=True, converters=(), compiler_options=None, includes=None, system_includes=None, libclang_location=None, shell_command='', parse_all_comments=True, target_file_only=False): """ Parse the file at construction Parameters ----------- filename : string Name of the file to parse namespaces : list of string Restrict the generation to the given namespaces. classes : list of string Restrict the generation to the given classes. appname : string Name of the application modulename : string Name of the module moduledoc : string Documentation of the module shell_command : string script command that was called (to regenerate the desc file) use_properties : Boolean Transform method with no args into property members_read_only : Boolean The members are wrapped "read only" includes : string, optional Additional includes to add (-I xxx) for clang system_includes : string, optional Additional System includes to add (-isystem xxx) for clang compiler_options : string, optional Additional option for clang compiler libclang_location : string, optional Absolute path to libclang. By default, the detected one. parse_all_comments : bool Grab all comments, including non doxygen like [default = True] target_file_only : bool Neglect any included files during desc generation [default = False] """ for x in [ 'filename', 'namespaces', 'classes', 'namespace_to_factor', 'appname', 'modulename', 'moduledoc', 'use_properties', 'members_read_only', 'shell_command', 'target_file_only' ]: setattr(self, x, locals()[x]) self.DE = dependency_analyzer.DependencyAnalyzer(converters) # parse the file self.root = CL.parse(filename, compiler_options, includes, system_includes, libclang_location, parse_all_comments)
def __init__(self, tools_path, **params): self.project_path = os.getcwd().replace('\\', '/') self.Decider('MD5-timestamp') self.deps_analyzer = dependency_analyzer.DependencyAnalyzer() project_db = projectdb.ProjectDB("--obj/project.pickle") project_db['paths'] = { 'graphviz': '', 'python': '', 'inkscape': '', 'tex': '', 'gs': '' } if platform.system() != 'Linux': project_db['paths']['graphviz'] = os.path.join( tools_path, "graphviz", "bin") project_db['paths']['python'] = os.path.join( tools_path, "python27") project_db['paths']['inkscape'] = os.path.join( tools_path, "inkscape") project_db['paths']['tex'] = os.path.join(tools_path, r"xetex\bin\win32") project_db['paths']['gs'] = os.path.join(tools_path, r"xetex\tlpkg\tlgs\bin") os.environ['PATH'] = ';'.join([ project_db['paths']['python'], project_db['paths']['tex'], project_db['paths']['gs'], os.environ['PATH'] ]) self.project_db = project_db Environment.__init__(self, **params) self['ENV']['PATH'] = os.environ['PATH'] self.project_db["include_commands"] = [{ 'regexp': r'\n[^%]*?\\(include|input|localInclude){(?P<relfile>[^#}]+)}', 'file': '%(relfile)s', 'ext': '.tex' }, { 'regexp': r'\n[^%]*?\\(verbatiminput){(?P<relfile>[^#}]+)}', 'file': '%(relfile)s', 'ext': '' }, { 'regexp': r'\n[^%]*?\\(includeOnce){(?P<relfile>[^#}]+)}', 'file': r'\projectpath/%(relfile)s', 'ext': '.tex' }, { 'regexp': r'(?s)\n[^%]*?\\(localPDF)(\[[^\[]*\])?{(?P<relfile>[^#}]+)}', 'file': r'', 'ext': '.pdf' }, { 'regexp': r'\n[^%]*?\\(localSVG)(\[.*\])?{(?P<dir>[^#}]+)}{(?P<relfile>[^#}]+)}', 'file': r'%(dir)s/--obj/%(relfile)s.svg.obj/obj.pdf', 'ext': '' }, { 'regexp': r'\n[^%]*?\\(projectSVG)(\[.*\])?{(?P<dir>[^#}]+)}{(?P<relfile>[^#}]+)}', 'file': r'\projectpath/%(dir)s/--obj/%(relfile)s.svg.obj/obj.pdf', 'ext': '' }] for item in self.project_db["include_commands"]: if "re" not in item: item["re"] = re.compile(item['regexp']) self.executors = {} self.meta_analyzer = mydepends.MetaAnalyzer(self) metascan = Scanner(function=self.meta_analyzer.meta_scan, skeys=['.meta'], recursive=0) self.Append(SCANNERS=metascan) depsscan = Scanner(function=self.meta_analyzer.deps_scan, skeys=['.deps'], recursive=0) self.Append(SCANNERS=depsscan) #texscan = Scanner(function = ds.tex_scan, skeys = ['.tex'], recursive = 0) #self.Append(SCANNERS = texscan ) #svgscan = Scanner(function = ds.svg_scan, skeys = ['.svg'], recursive = 1) #self.Append(SCANNERS = svgscan ) self.warnings = []