X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=lib%2Fconfigure.py;h=c6c2ddd6202742b97c5f6af9cac92b6168e719d6;hb=88099cf89aa6db90ed862f43348c9ed8c48b08a4;hp=16994d2924bc500179af1c1ad7ee82ec1c37da4b;hpb=022bcb105c784efabc301a63afd1c8acf56d72fc;p=lyx.git diff --git a/lib/configure.py b/lib/configure.py index 16994d2924..c6c2ddd620 100644 --- a/lib/configure.py +++ b/lib/configure.py @@ -737,6 +737,57 @@ s!@chk_docbook@!%s!g ''.join(lyxin)) +def checkModulesConfig(): + removeFiles(['lyxmodules.lst']) + + print '+checking list of modules... ' + tx = open('lyxmodules.lst', 'w') + tx.write('''## This file declares modules and their associated definition files. +## It has been automatically generated by configure +## Use "Options/Reconfigure" if you need to update it after a +## configuration change. +''') + # build the list of available modules + foundClasses = [] + for file in glob.glob( os.path.join('layouts', '*.module') ) + \ + glob.glob( os.path.join(srcdir, 'layouts', '*.module' ) ) : + # valid file? + print file + if not os.path.isfile(file): + continue + tx.write(processModuleFile(file, bool_docbook, bool_linuxdoc)) + tx.close() + print '\tdone' + +def processModuleFile(file, bool_docbook, bool_linuxdoc): + ''' process module file and get a line of result + + Declare lines look like this: + \DeclareLyXModule[LaTeX Packages]{Description}{ModuleName}... + We expect output: + "ModuleName" "filename" "Description" "Packages" + " + ''' + p = re.compile(r'\DeclareLyXModule\s*(?:\[([^]]*)\])?{(.*)}{(.*)}') + for line in open(file).readlines(): + res = p.search(line) + if res != None: + (packages, desc, modname) = res.groups() + #check availability...need to add that + if packages == None: + packages = "" + else: + pkgs = [s.strip() for s in packages.split(",")] + packages = ",".join(pkgs) + + filename = file.split(os.sep)[-1] + return '"%s" "%s" "%s" "%s"\n' % (modname, filename, desc, packages) + print "Module file without \DeclareLyXModule line. " + sys.exit(2) + + + + def checkTeXAllowSpaces(): ''' Let's check whether spaces are allowed in TeX file names ''' tex_allows_spaces = 'false' @@ -830,4 +881,5 @@ Options: # --without-latex-config can disable lyx_check_config checkLatexConfig( lyx_check_config and LATEX != '', bool_docbook, bool_linuxdoc) createLaTeXConfig() + checkModulesConfig() #lyx_check_config and LATEX != '') removeTempFiles()