Recommit previously unintended commit, now that it has been approved. ;-)

Seriously, this resovles a problem with module detection and configuration, 
namely, that we detect BOTH a module in the system directory and a custom
version of it in the user directory.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38387 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2011-04-15 00:54:50 +00:00
parent ce738218e2
commit ec14c3f364

View File

@ -1169,22 +1169,32 @@ def checkModulesConfig():
## configuration change. ## configuration change.
## "ModuleName" "filename" "Description" "Packages" "Requires" "Excludes" "Category" ## "ModuleName" "filename" "Description" "Packages" "Requires" "Excludes" "Category"
''') ''')
# build the list of available modules # build the list of available modules
foundClasses = [] seen = []
# note that this searches the local directory first, then the
# system directory. that way, we pick up the user's version first.
for file in glob.glob( os.path.join('layouts', '*.module') ) + \ for file in glob.glob( os.path.join('layouts', '*.module') ) + \
glob.glob( os.path.join(srcdir, 'layouts', '*.module' ) ) : glob.glob( os.path.join(srcdir, 'layouts', '*.module' ) ) :
# valid file? # valid file?
logger.info(file) logger.info(file)
if not os.path.isfile(file): if not os.path.isfile(file):
continue continue
retval = processModuleFile(file, bool_docbook)
filename = file.split(os.sep)[-1]
filename = filename[:-7]
if seen.count(filename):
continue
seen.append(filename)
retval = processModuleFile(file, filename, bool_docbook)
if retval != "": if retval != "":
tx.write(retval) tx.write(retval)
tx.close() tx.close()
logger.info('\tdone') logger.info('\tdone')
def processModuleFile(file, bool_docbook): def processModuleFile(file, filename, bool_docbook):
''' process module file and get a line of result ''' process module file and get a line of result
The top of a module file should look like this: The top of a module file should look like this:
@ -1209,8 +1219,6 @@ def processModuleFile(file, bool_docbook):
modname = desc = pkgs = req = excl = catgy = "" modname = desc = pkgs = req = excl = catgy = ""
readingDescription = False readingDescription = False
descLines = [] descLines = []
filename = file.split(os.sep)[-1]
filename = filename[:-7]
for line in open(file).readlines(): for line in open(file).readlines():
if readingDescription: if readingDescription: