Hi,

Some time ago I asked you to add support for eLyXer as a module, to
solve some integration problems that Uwe Stöhr found when testing it.
It allowed eLyXer to be used as a Python module:
  $ python -m elyxer ...
and fall back to using it as a script if the module was not found:
  $ elyxer.py ...
I believe those problems were an artifact of some special setup on his
machine; I was not able to reproduce the problem on a different
Windows machine at the time with the same versions, and enquiries on
some Python forums shone no light into the problem. There were also no
other reports of the same kind. I have contacted him to see if he can
still reproduce the problem but he is unable to work on it at the
moment.

At this point I would like to convert eLyXer into a proper Python
package: instead of coalescing all source code into a single elyxer.py
script, the best option would be to let Python install all source code
as a package, and load eLyXer from a small script (which would still
be called elyxer.py). The package would be called "elyxer", which
might confuse configure.py into thinking the "elyxer" module is
installed: checkModule() just tries to import something called
"elyxer", which succeeds both for a module elyxer.py and for a package
elyxer. Therefore an error would be shown about trying to execute a
module as a package.

This change would allow people to install and use the proper eLyXer
source code instead of having some huge and complex Python script.
Also, the installation procedure for eLyXer would be much simplified.
Having a proper Python package would lead to other uses for eLyXer,
one of which is being integrated into Python docutils. Also, Günter
Milde has shown some very real problems with loading eLyXer as a
module: technically LyX would accept any module _or_ package called
elyxer, and would load it in configure.py, which might lead to
undesired behaviors.

So at this point I would like to ask Pavel, the release manager for
2.0 to remove support for eLyXer as a module:
  $ python -m elyxer ...
and instead use it always as a binary:
  $ elyxer.py ...
Backwards compatibility with all previous versions of eLyXer is
assured, as elyxer.py was always installed if permissions allowed
(which should be always, as the script install.py tried to make sure
of it). For now, I will remove the ability to install eLyXer as a
module and instead install the coalesced script, which in time can be
replaced with a short loader script for the package. Forward
compatibility is again assured by use of the elyxer.py script. The
problem remains that old versions of LyX might stop working with new
versions of eLyXer, after eLyXer is installed as a package, but this
scenario should not be too common and can be documented easily in
eLyXer -- and in the LyX wiki.

There is also a bug in the current configure.py: it will try to use
eLyXer as a module when exporting to Word, even if it only finds
eLyXer as a binary. This issue might cause additional problems for
users of old versions of LyX with new versions of eLyXer when
exporting to Word, but again it should not be too common and can be
mitigated with good documentation.

I am attaching a patch to remove support for eLyXer as a module from
LyX 2.0, and correct the bug. Support for lyxblogger (which is also
loaded as a module) is maintained as is. If it is accepted I will send
another patch for branch so LyX 1.6.x does the same, and at some point
LyX will be ready to use eLyXer as a package (with a frontend
elyxer.py). I think I have addressed all compatibility issues
(backwards and forward), but I am sure something has escaped me; if
there is any problem please let me know so we can work it out.

Thanks,

Alex Fernández.
Index: lib/configure.py
===================================================================
--- lib/configure.py	(revisión: 37256)
+++ lib/configure.py	(copia de trabajo)
@@ -638,19 +638,19 @@
     checkProg('an MS Word -> LaTeX converter', ['wvCleanLatex $$i $$o'],
         rc_entry = [ r'\converter word       latex      "%%"	""' ])
 
-    # 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: search as an executable (elyxer.py, elyxer)
+    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
+    path, elyxer = checkProg('a LyX -> MS Word converter',
+        ['elyxer.py --directory $$r $$i $$o', 'elyxer --html --directory $$r $$i $$o'],
+        rc_entry = [ r'\converter lyx      wordhtml       "%%"	""' ])
+    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"''')
+      addToRC(r'''\copier    wordhtml       "python -tt $$s/scripts/ext_copy.py -e html,png,jpg,jpeg,css $$i $$o"''')
     else:
       # search for other converters than eLyXer
       # On SuSE the scripts have a .sh suffix, and on debian they are in /usr/share/tex4ht/
@@ -662,27 +662,6 @@
         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"''')
-
-    # Check if LyXBlogger is installed
-    lyxblogger_found = checkModule('lyxblogger')
-    if lyxblogger_found:
-      addToRC(r'\Format    blog       blog       "LyXBlogger"           "" "" ""  "document"')
-      addToRC(r'\converter xhtml      blog       "python -m lyxblogger $$i"       ""')
-
-    if elyxerfound:
-      addToRC(r'''\converter lyx      wordhtml       "python -m elyxer --html --directory $$r $$i $$o"	""''')
-    else:
-      path, elyxer = checkProg('a LyX -> MS Word converter',
-        ['elyxer.py --directory $$r $$i $$o', 'elyxer --html --directory $$r $$i $$o'],
-        rc_entry = [ r'\converter lyx      wordhtml       "%%"	""' ])
-      if elyxer.find('elyxer') >= 0:
-        elyxerfound = True
-
-    if elyxerfound:
-      addToRC(r'''\copier    wordhtml       "python -tt $$s/scripts/ext_copy.py -e html,png,jpg,jpeg,css $$i $$o"''')
-    else:
-      # search for other converters than eLyXer
-      # 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'", \
           "htlatex.sh $$i 'html,word' 'symbol/!' '-cvalidate'", \
           "/usr/share/tex4ht/htlatex $$i 'html,word' 'symbol/!' '-cvalidate'"],
@@ -692,7 +671,14 @@
       else:
         addToRC(r'''\copier    wordhtml       "python -tt $$s/scripts/ext_copy.py $$i $$o"''')
 
-    #
+
+    # Check if LyXBlogger is installed
+    lyxblogger_found = checkModule('lyxblogger')
+    if lyxblogger_found:
+      addToRC(r'\Format    blog       blog       "LyXBlogger"           "" "" ""  "document"')
+      addToRC(r'\converter xhtml      blog       "python -m lyxblogger $$i"       ""')
+
+#
     checkProg('an OpenOffice.org -> LaTeX converter', ['w2l -clean $$i'],
         rc_entry = [ r'\converter sxw        latex      "%%"	""' ])
     #

Reply via email to