On Mon, Oct 19, 2009 at 9:47 AM, Jürgen Spitzmüller <sp...@lyx.org> wrote: > Uwe Stöhr wrote: >> The following path is needed for configure.py to make eLyXer working >> properly. OK to go in? (It is already in trunk for some weeks.) > > So the directory switch has become obsolete? I remember it was introduced in > order to fix some problems with images.
The switch is there. What I see is that with the patch LyX is going to look for two executables in the path: elyxer.py or elyxer: + path, elyxer = checkProg('a LyX -> HTML converter', ['elyxer.py', 'elyxer'], and then it is going to execute a different elyxer.py from the scripts directory anyway, ignoring those in the path: + rc_entry = [ r'\converter lyx html "python -tt $$s/scripts/elyxer.py --directory $$r $$i $$o" ""' ]) This copy of elyxer.py in the scripts directory has to be distributed along with LyX, either standalone or in the installer. This is going to result in strange behavior for people who have already downloaded eLyXer from a different source (not many of them, granted). Either LyX will add the converter and the copier but then it will not work, if LyX does not include eLyXer; or LyX will detect their copy but then use the included one, for those installations that include eLyXer. It will also result in weird behavior for those that do _not_ have eLyXer installed: even if their installer includes eLyXer, it will fail to detect an executable with the name elyxer.py, or elyxer, and the copy in the scripts directory will never be used. In short, this patch will not do what is expected for anyone. The recommended way of running eLyXer is as a module; I sent a patch to the list that tried to first detect the module and then the executable. Sadly, I then failed to come through with the suggested improvements (I guess I was too busy with childish preemptive trolling): http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg154797.html Please find enclosed elyxer-module2.diff, a finished version of that patch. It will work with eLyXer as a module or as an executable in the path, and should address those concerns raised at the time. This will perhaps not be satisfactory to Uwe and other integrators who wish to distribute eLyXer in a known location, such as the scripts folder -- instead of placing it onto the executable path. I am not sure about the best way to do that, since there are conflicting goals: distribute eLyXer but only if the user chooses to (unlike other scripts which are always present with LyX). I would propose these three solutions, in order of preference: - install eLyXer as a Python module, - install eLyXer in the path, - install eLyXer unconditionally and just add it as a converter, unconditionally, - or auto-detect elyxer.py in the scripts folder. The first two options are covered with elyxer-module2.diff. The third option would require a different patch enclosed as elyxer-unconditional.diff (but requires to make eLyXer mandatory, which I am not sure I like -- people have a right to choose inferior solutions :). Finally, the last option (auto-detect in the scripts folder) is out of my reach -- I don't know enough LyX or Python to do that. Alex.
Index: lib/configure.py =================================================================== --- lib/configure.py (revisión: 31679) +++ lib/configure.py (copia de trabajo) @@ -248,6 +248,18 @@ return ['', not_found] +def checkModule(module): + ''' Check for a Python module, return the status ''' + msg = 'checking for "' + module + ' module"... ' + try: + __import__(module) + logger.info(msg + ' yes') + return True + except ImportError: + logger.info(msg + ' no') + return False + + def addViewerAlternatives(rcs): r = re.compile(r'\\Format (\S+).*$') m = None @@ -605,9 +617,17 @@ checkProg('an MS Word -> LaTeX converter', ['wvCleanLatex $$i $$o'], rc_entry = [ r'\converter word latex "%%" ""' ]) # - path, elyxer = checkProg('a LyX -> HTML converter', ['elyxer.py', 'elyxer'], - rc_entry = [ r'\converter lyx html "python -tt $$s/scripts/elyxer.py --directory $$r $$i $$o" ""' ]) - if elyxer.find('elyxer') >= 0: + # eLyXer: search as a Python module and then as an executable (elyxer.py, elyxer) + elyxerfound = checkModule('elyxer') + if elyxerfound: + addToRC(r'''\converter lyx html "python -m elyxer --directory $$r $$i $$o" ""''') + else: + path, elyxer = checkProg('a LyX -> HTML converter', ['elyxer.py --directory $$r $$i $$o','elyxer --directory $$r $$i $$o'], + rc_entry = [ r'\converter lyx html "%%" ""' ]) + if elyxer.find('elyxer') >= 0: + elyxerfound = True + + if elyxerfound: addToRC(r'''\copier html "python -tt $$s/scripts/ext_copy.py -e html,png,jpg,jpeg,css $$i $$o"''') else: # On SuSE the scripts have a .sh suffix, and on debian they are in /usr/share/tex4ht/
Index: lib/configure.py =================================================================== --- lib/configure.py (revisión: 31679) +++ lib/configure.py (copia de trabajo) @@ -605,20 +605,8 @@ checkProg('an MS Word -> LaTeX converter', ['wvCleanLatex $$i $$o'], rc_entry = [ r'\converter word latex "%%" ""' ]) # - path, elyxer = checkProg('a LyX -> HTML converter', ['elyxer.py', 'elyxer'], - rc_entry = [ r'\converter lyx html "python -tt $$s/scripts/elyxer.py --directory $$r $$i $$o" ""' ]) - if elyxer.find('elyxer') >= 0: - addToRC(r'''\copier html "python -tt $$s/scripts/ext_copy.py -e html,png,jpg,jpeg,css $$i $$o"''') - else: - # On SuSE the scripts have a .sh suffix, and on debian they are in /usr/share/tex4ht/ - path, htmlconv = checkProg('a LaTeX -> HTML converter', ['htlatex $$i', 'htlatex.sh $$i', \ - '/usr/share/tex4ht/htlatex $$i', 'tth -t -e2 -L$$b < $$i > $$o', \ - 'latex2html -no_subdir -split 0 -show_section_numbers $$i', 'hevea -s $$i'], - rc_entry = [ r'\converter latex html "%%" "needaux"' ]) - if htmlconv.find('htlatex') >= 0 or htmlconv == 'latex2html': - addToRC(r'''\copier html "python -tt $$s/scripts/ext_copy.py -e html,png,css $$i $$o"''') - else: - addToRC(r'''\copier html "python -tt $$s/scripts/ext_copy.py $$i $$o"''') + addToRC(r'\converter lyx html "python -tt $$s/scripts/elyxer.py --directory $$r $$i $$o" ""') + addToRC(r'''\copier html "python -tt $$s/scripts/ext_copy.py -e html,png,jpg,jpeg,css $$i $$o"''') # On SuSE the scripts have a .sh suffix, and on debian they are in /usr/share/tex4ht/ path, htmlconv = checkProg('a LaTeX -> MS Word converter', ["htlatex $$i 'html,word' 'symbol/!' '-cvalidate'", \