]> git.lyx.org Git - features.git/commitdiff
configure.py: fix check for eLyXer
authorUwe Stöhr <uwestoehr@web.de>
Sat, 7 Nov 2009 16:55:23 +0000 (16:55 +0000)
committerUwe Stöhr <uwestoehr@web.de>
Sat, 7 Nov 2009 16:55:23 +0000 (16:55 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31897 a592a061-630c-0410-9148-cb99ea01b6c8

lib/configure.py

index 3fe21a5c7aa87caf7c3038d946243bc9b5a0e289..beea4bd03518e08bc8fc594bf290cc236bc9c28c 100644 (file)
@@ -427,6 +427,16 @@ def checkLatex(dtl_tools):
     return ''
 
 
+def checkModule(module):
+    ''' Check for a Python module, return the status '''
+    msg = 'checking for "' + module + ' module"... '
+    try:
+      __import__(module)
+      return True
+    except ImportError:
+      return False
+
+
 def checkFormatEntries(dtl_tools):  
     ''' Check all formats (\Format entries) '''
     checkViewerEditor('a Tgif viewer and editor', ['tgif'],
@@ -604,10 +614,17 @@ def checkConverterEntries():
     #
     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', 'elyxer'],
+        rc_entry = [ r'\converter lyx      html       "python -tt elyxer.py --directory $$r $$i $$o"   ""' ])
+      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/