X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=lib%2Fconfigure.py;h=872e2ac50d2d064837ea07c4459770bcc6f310f0;hb=653376087d4107e127d577d6a4f29351a9d46b05;hp=15a6095f1b0c133806d4676dfbe4bbc8e491971c;hpb=834604ea5d1a2db13f7f76e3baf1a16ed731c8d1;p=lyx.git diff --git a/lib/configure.py b/lib/configure.py index 15a6095f1b..872e2ac50d 100644 --- a/lib/configure.py +++ b/lib/configure.py @@ -261,26 +261,37 @@ 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. 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 checkViewer(description, progs, rc_entry = [], path = []): - ''' The same as checkProgAlternatives, but for viewers ''' +def listAlternatives(progs, alt_type, rc_entry = []): + ''' + Returns a list of \\prog_alternatives strings to be used as alternative + 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.") sys.exit(2) @@ -288,75 +299,45 @@ def checkViewer(description, progs, rc_entry = [], path = []): for idx in range(len(progs)): if len(rc_entry) == 1: rcs = rc_entry[0].split('\n') - alt = addAlternatives(rcs, 'viewer') + alt = addAlternatives(rcs, alt_type) alt_rc_entry.insert(0, alt) elif len(rc_entry) > 1: rcs = rc_entry[idx].split('\n') - alt = addAlternatives(rcs, 'viewer') + alt = addAlternatives(rcs, alt_type) alt_rc_entry.insert(idx, alt) + return alt_rc_entry + + +def checkViewer(description, progs, rc_entry = [], path = []): + ''' The same as checkProgAlternatives, but for viewers ''' + alt_rc_entry = listAlternatives(progs, 'viewer', rc_entry) return checkProgAlternatives(description, progs, rc_entry, alt_rc_entry, path, not_found = 'auto') def checkEditor(description, progs, rc_entry = [], path = []): ''' The same as checkProgAlternatives, but for editors ''' - 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.") - sys.exit(2) - alt_rc_entry = [] - for idx in range(len(progs)): - if len(rc_entry) == 1: - rcs = rc_entry[0].split('\n') - alt = addAlternatives(rcs, 'editor') - alt_rc_entry.insert(0, alt) - elif len(rc_entry) > 1: - rcs = rc_entry[idx].split('\n') - alt = addAlternatives(rcs, 'editor') - alt_rc_entry.insert(idx, alt) + alt_rc_entry = listAlternatives(progs, 'editor', rc_entry) return checkProgAlternatives(description, progs, rc_entry, alt_rc_entry, path, not_found = 'auto') def checkViewerNoRC(description, progs, rc_entry = [], path = []): ''' The same as checkViewer, but do not add rc entry ''' - 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.") - sys.exit(2) - alt_rc_entry = [] - for idx in range(len(progs)): - if len(rc_entry) == 1: - rcs = rc_entry[0].split('\n') - alt = addAlternatives(rcs, 'viewer') - alt_rc_entry.insert(0, alt) - elif len(rc_entry) > 1: - rcs = rc_entry[idx].split('\n') - alt = addAlternatives(rcs, 'viewer') - alt_rc_entry.insert(idx, alt) + alt_rc_entry = listAlternatives(progs, 'viewer', rc_entry) rc_entry = [] return checkProgAlternatives(description, progs, rc_entry, alt_rc_entry, path, not_found = 'auto') def checkEditorNoRC(description, progs, rc_entry = [], path = []): ''' The same as checkViewer, but do not add rc entry ''' - 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.") - sys.exit(2) - alt_rc_entry = [] - for idx in range(len(progs)): - if len(rc_entry) == 1: - rcs = rc_entry[0].split('\n') - alt = addAlternatives(rcs, 'editor') - alt_rc_entry.insert(0, alt) - elif len(rc_entry) > 1: - rcs = rc_entry[idx].split('\n') - alt = addAlternatives(rcs, 'editor') - alt_rc_entry.insert(idx, alt) + alt_rc_entry = listAlternatives(progs, 'editor', rc_entry) rc_entry = [] return checkProgAlternatives(description, progs, rc_entry, alt_rc_entry, path, not_found = 'auto') def checkViewerEditor(description, progs, rc_entry = [], path = []): ''' The same as checkProgAlternatives, but for viewers and editors ''' - checkEditorNoRC(description, progs, rc_entry, path) - return checkViewer(description, progs, rc_entry, path) + alt_rc_entry = listAlternatives(progs, ['editor', 'viewer'], rc_entry) + return checkProgAlternatives(description, progs, rc_entry, alt_rc_entry, path, not_found = 'auto') def checkDTLtools(): @@ -449,7 +430,7 @@ def checkLuatex(): logger.info(msg + ' yes') addToRC(r'\converter luatex pdf5 "%s" "latex=lualatex"' % LUATEX) if DVILUATEX != '': - addToRC(r'\converter luatex dvi3 "%s" "latex=lualatex"' % DVILUATEX) + addToRC(r'\converter luatex dvi3 "%s" "latex=dvilualatex"' % DVILUATEX) # remove temporary files removeFiles(['luatest.tex', 'luatest.log', 'luatest.aux', 'luatest.pdf']) @@ -527,7 +508,7 @@ def checkFormatEntries(dtl_tools): \Format asciixfig asc "Plain text (Xfig output)" "" "" "%%" "" \Format dateout tmp "date (output)" "" "" "%%" "" \Format docbook sgml DocBook B "" "%%" "document,menu=export" -\Format docbook-xml xml "Docbook (XML)" "" "" "%%" "document,menu=export" +\Format docbook-xml xml "DocBook (XML)" "" "" "%%" "document,menu=export" \Format dot dot "Graphviz Dot" "" "" "%%" "vector" \Format platex tex "LaTeX (pLaTeX)" "" "" "%%" "document,menu=export" \Format literate nw NoWeb N "" "%%" "document,menu=export" @@ -565,7 +546,7 @@ def checkFormatEntries(dtl_tools): # rc_entry = [ r'\ps_command "%%"' ]) checkViewer('a Postscript previewer', ['kghostview', 'okular', 'evince', 'gv', 'ghostview -swap'], rc_entry = [r'''\Format eps eps EPS "" "%%" "" "vector" -\Format ps ps Postscript t "%%" "" "document,vector"''']) +\Format ps ps Postscript t "%%" "" "document,vector,menu=export"''']) # for xdg-open issues look here: http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg151818.html checkViewer('a PDF previewer', ['kpdf', 'okular', 'evince', 'kghostview', 'xpdf', 'acrobat', 'acroread', \ 'gv', 'ghostview'], @@ -605,6 +586,7 @@ def checkFormatEntries(dtl_tools): \Format lyx14x 14.lyx "LyX 1.4.x" "" "" "" "document" \Format lyx15x 15.lyx "LyX 1.5.x" "" "" "" "document" \Format lyx16x 16.lyx "LyX 1.6.x" "" "" "" "document,menu=export" +\Format lyx20x 20.lyx "LyX 2.0.x" "" "" "" "document,menu=export" \Format clyx cjklyx "CJK LyX 1.4.x (big5)" "" "" "" "document" \Format jlyx cjklyx "CJK LyX 1.4.x (euc-jp)" "" "" "" "document" \Format klyx cjklyx "CJK LyX 1.4.x (euc-kr)" "" "" "" "document" @@ -921,6 +903,7 @@ def checkConverterEntries(): \converter lyx lyx14x "python -tt $$s/lyx2lyx/lyx2lyx -t 245 $$i > $$o" "" \converter lyx lyx15x "python -tt $$s/lyx2lyx/lyx2lyx -t 276 $$i > $$o" "" \converter lyx lyx16x "python -tt $$s/lyx2lyx/lyx2lyx -t 345 $$i > $$o" "" +\converter lyx lyx20x "python -tt $$s/lyx2lyx/lyx2lyx -t 413 $$i > $$o" "" \converter lyx clyx "python -tt $$s/lyx2lyx/lyx2lyx -c big5 -t 245 $$i > $$o" "" \converter lyx jlyx "python -tt $$s/lyx2lyx/lyx2lyx -c euc_jp -t 245 $$i > $$o" "" \converter lyx klyx "python -tt $$s/lyx2lyx/lyx2lyx -c euc_kr -t 245 $$i > $$o" ""