lyx-devel  

Re: eLyXer integration, round three

rgheck
Sat, 19 Sep 2009 18:58:04 -0700

On 09/19/2009 06:54 PM, Pavel Sanda wrote:
Alex Fernandez wrote:
Index: configure.py
===================================================================
--- configure.py        (revisión: 31391)
+++ configure.py        (copia de trabajo)
@@ -605,9 +605,22 @@
      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 = False
+    msg = 'checking for "eLyXer module"... '
+    try:
+      import elyxer
+      addToRC(r'''\converter lyx      html       "python -m elyxer --directory $$r $$i 
$$o"  ""''')
i'm not on my computer to try this out, so at least question - in case
elyxer is not present in the system this will add conveter to RC, right?
does elyxer appears in the menu too?

If the elyxer module isn't present, the import throws an exception, and you never hit this line. Instead, you end up in the except clause, below, where we test for the elyxer executable, as normal.

I see no problem with this patch, though I'd prefer, as I said in the other message, a checkModule() routine that hid some of the messiness here.

+      elyxerfound = True
+      logger.info(msg + ' yes')
+    except ImportError:
+      logger.info(msg + ' no')
+      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/