Package: calibre
Version: 2.45.0+dfsg-1
Severity: important
Tags: patch

Invocating markdown-calibre fails with an ImportError:

  Traceback (most recent call last):
    File "/usr/bin/markdown-calibre", line 19, in <module>
      from calibre.ebooks.markdown.__main__ import run
  ImportError: No module named markdown.__main__

this happens because the command fixing the import statements for
calibre.ebooks.markdown in debian/rules:

  find debian/tmp/ -name '*.py' | xargs sed -i 
's/calibre.ebooks.markdown/markdown/g'

only affects files having a .py extension which the executable
/usr/bin/markdown-calibre does not have so that markdown-calibre
continues to be included in the package with the wrong import statement.

In case markdown-calibre should continue to be part of the calibre
package (it does not appear to do more than /usr/bin/markdown_py from
the python-markdown package) I created an updated
use_system_markdown.patch file that I appended.

Alternatively one could adjust the aforementioned find command in
debian/rules to also list the markdown-calibre file:

  find debian/tmp -name "*.py" -or -name "markdown-calibre" | ...


I do not know which is to be preferred and am wondering: is there a
reason to motify the imports both via a patch file and by using sed in
debian/rules?


Another option might be to remove the calibre-markdown executable – if
it in fact does the same thing as markdown_py from python-markdown –
from the package as I did not find invocations of markdown-calibre in
the source using grep (grep -r markdown-calibre .).


--
Felix Dietrich


Author: Dmitry Shachnev <mity...@gmail.com>
Description: use system python-markdown
Forwarded: not-needed
Last-Update: 2013-04-04

Index: calibre-2.45.0+dfsg/src/calibre/library/comments.py
===================================================================
--- calibre-2.45.0+dfsg.orig/src/calibre/library/comments.py
+++ calibre-2.45.0+dfsg/src/calibre/library/comments.py
@@ -150,7 +150,7 @@ def sanitize_html(html):
     return serializer.render(stream)
 
 def sanitize_comments_html(html):
-    from calibre.ebooks.markdown import Markdown
+    from markdown import Markdown
     text = html2text(html)
     md = Markdown()
     html = md.convert(text)
Index: calibre-2.45.0+dfsg/src/calibre/linux.py
===================================================================
--- calibre-2.45.0+dfsg.orig/src/calibre/linux.py
+++ calibre-2.45.0+dfsg/src/calibre/linux.py
@@ -20,7 +20,7 @@ entry_points = {
              'ebook-meta         = calibre.ebooks.metadata.cli:main',
              'ebook-convert      = calibre.ebooks.conversion.cli:main',
              'ebook-polish       = calibre.ebooks.oeb.polish.main:main',
-             'markdown-calibre   = calibre.ebooks.markdown.__main__:run',
+             'markdown-calibre   = markdown.__main__:run',
              'web2disk           = calibre.web.fetch.simple:main',
              'calibre-server     = calibre.library.server.main:main',
              'lrf2lrs            = calibre.ebooks.lrf.lrfparser:main',

Reply via email to