Bug 197218 - [PORT deskutils/calibre] Error while converting epub->pdf: "No plugin named u'qt_hack'"
Summary: [PORT deskutils/calibre] Error while converting epub->pdf: "No plugin named u...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Guido Falsi
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-31 04:43 UTC by Yuri Victorovich
Modified: 2015-02-01 15:47 UTC (History)
1 user (show)

See Also:


Attachments
calibre qt_hack fix (3.77 KB, patch)
2015-02-01 09:44 UTC, Guido Falsi
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri Victorovich freebsd_committer freebsd_triage 2015-01-31 04:43:10 UTC
I am getting the error message while attempting to convert epub to pdf.
calibre-1.48.0_2
Previous PR https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=183808 that is in "closed" state was in part about the same/similar problem. 

--- begin error log ---
Flattening CSS and remapping font sizes...
Source base font size is 12.00000pt
Removing fake margins...
Found 1918 items of level: div_1
div_1  left margin stats: Counter()
div_1  right margin stats: Counter()
Cleaning up manifest...
Trimming unused files from manifest...
Creating PDF Output...
Converting input as a text based book...
Serializing oeb input to disk for processing...
The cover image has an id != "cover". Renaming to work around bug in Nook Color
Rendering pages to PDF...
Traceback (most recent call last):
  File "/usr/local/bin/calibre-parallel", line 20, in <module>
    sys.exit(main())
  File "/usr/local/lib/calibre/calibre/utils/ipc/worker.py", line 195, in main
    result = func(*args, **kwargs)
  File "/usr/local/lib/calibre/calibre/gui2/convert/gui_conversion.py", line 31, in gui_convert_override
    override_input_metadata=True)
  File "/usr/local/lib/calibre/calibre/gui2/convert/gui_conversion.py", line 25, in gui_convert
    plumber.run()
  File "/usr/local/lib/calibre/calibre/ebooks/conversion/plumber.py", line 1194, in run
    self.opts, self.log)
  File "/usr/local/lib/calibre/calibre/ebooks/conversion/plugins/pdf_output.py", line 145, in convert
    self.convert_text(oeb_book)
  File "/usr/local/lib/calibre/calibre/ebooks/conversion/plugins/pdf_output.py", line 268, in convert_text
    'toc', None))
  File "/usr/local/lib/calibre/calibre/ebooks/conversion/plugins/pdf_output.py", line 294, in write
    writer.dump(items, out_stream, PDFMetadata(self.metadata))
  File "/usr/local/lib/calibre/calibre/ebooks/pdf/render/from_html.py", line 186, in dump
    mark_links=opts.pdf_mark_links)
  File "/usr/local/lib/calibre/calibre/ebooks/pdf/render/engine.py", line 325, in __init__
    mark_links=mark_links)
  File "/usr/local/lib/calibre/calibre/ebooks/pdf/render/engine.py", line 90, in __init__
    self.qt_hack, err = plugins['qt_hack']
  File "/usr/local/lib/calibre/calibre/constants.py", line 185, in __getitem__
    raise KeyError('No plugin named %r'%name)
KeyError: "No plugin named u'qt_hack'"
--- end error log ---
Comment 1 Guido Falsi freebsd_committer freebsd_triage 2015-01-31 15:02:01 UTC
Hi,

I need to perform some tests about this. I slightly remember there was some problem which prompted to disable that module some time ago.

I'll try to re-enable it and see if I can make it all work properly.

I'll report back as soon as I have some more information or a solution.

Thanks for your report.
Comment 2 Guido Falsi freebsd_committer freebsd_triage 2015-02-01 09:44:34 UTC
Created attachment 152434 [details]
calibre qt_hack fix

I have a patch which allows the "qt_hack" module to be built.

This module requires access to QT4 private headers, which are not installed along with QT4 ports, and as such should not be used by client software. This is definitely an hack, as the name implies.

To allow for this I make the calibre port extract the QT4 sources from the x11-toolkits/qt4-gui port and tell calibre to look there for the private includes.

I have not looked at the qt_hack sources, but , since it's using private includes, I bet it's doing something with QT internal structures. This means that whenever the QT4 ports are modified/updated the qt_hack module could brake and anyway needs to be recompiled.

So, please test the attached patch, which works for me, and report back if it fixes the problem for you too. I'm checking if the practice described above is acceptable for the ports tree.

Thanks.
Comment 3 Yuri Victorovich freebsd_committer freebsd_triage 2015-02-01 11:31:24 UTC
The attached patch fixed the problem of epub->pdf conversion for me.
Comment 4 Yuri Victorovich freebsd_committer freebsd_triage 2015-02-01 11:32:35 UTC
Thanks for your quick response!
Comment 5 commit-hook freebsd_committer freebsd_triage 2015-02-01 15:46:31 UTC
A commit references this bug:

Author: madpilot
Date: Sun Feb  1 15:46:06 UTC 2015
New revision: 378248
URL: https://svnweb.freebsd.org/changeset/ports/378248

Log:
  - Enable the qt_hack component. It requires private qt headers, so
    add a depend on extracting those from the qt4-gui port [1]
  - While here, strip binaries

  PR:		197218 [1]
  Submitted by:	yuri@rawbw.com

Changes:
  head/deskutils/calibre/Makefile
  head/deskutils/calibre/files/patch-calibre_constants.py
  head/deskutils/calibre/files/patch-setup_extensions.py
  head/deskutils/calibre/pkg-plist
Comment 6 Guido Falsi freebsd_committer freebsd_triage 2015-02-01 15:47:07 UTC
Patch committed.

Thanks to you for your report and testing.