From 9c9e43da3f91af3825ab571410d733fcfd4820d0 Mon Sep 17 00:00:00 2001 From: Julien Rioux Date: Wed, 15 Jun 2011 22:27:44 +0000 Subject: [PATCH] configure.py : Allow to specify alt_type as a list. The intend is to specify ['editor', 'viewer'] eventually. Still no change in the produced output and in lyxrc.defaults git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@39078 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/configure.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/configure.py b/lib/configure.py index c97af47d66..6fe2f275dc 100644 --- a/lib/configure.py +++ b/lib/configure.py @@ -263,30 +263,34 @@ def checkProgAlternatives(description, progs, rc_entry = [], alt_rc_entry = [], def addAlternatives(rcs, alt_type): ''' Returns a \\prog_alternatives string to be used as an alternative - rc entry. + rc entry. alt_type can be a string or a list of strings. ''' r = re.compile(r'\\Format (\S+).*$') m = None alt = '' - alt_token = '\\%s_alternatives ' % alt_type + alt_token = '\\%s_alternatives ' + if isinstance(alt_type, str): + alt_tokens = [alt_token % alt_type] + else: + alt_tokens = map(lambda s: alt_token % s, alt_type) for idxx in range(len(rcs)): if len(rcs) == 1: m = r.match(rcs[0]) if m: - alt = alt_token + m.group(1) + " %%" + alt = '\n'.join([s + m.group(1) + " %%" for s in alt_tokens]) elif len(rcs) > 1: m = r.match(rcs[idxx]) if m: if idxx > 0: alt += '\n' - alt += alt_token + m.group(1) + " %%" + alt += '\n'.join([s + m.group(1) + " %%" for s in alt_tokens]) return alt def listAlternatives(progs, alt_type, rc_entry = []): ''' Returns a list of \\prog_alternatives strings to be used as alternative - rc entries. + rc entries. alt_type can be a string or a list of strings. ''' if len(rc_entry) > 1 and len(rc_entry) != len(progs) + 1: logger.error("rc entry should have one item or item for each prog and not_found.") -- 2.39.2