Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 555234

Summary: app-text/calibre-2.31.0 - plugins depending on bundled BeautifulSoup do not work
Product: Gentoo Linux Reporter: ukonkivi
Component: Current packagesAssignee: Ian Stakenvicius (RETIRED) <axs>
Status: RESOLVED NEEDINFO    
Severity: normal CC: jstein, yngwin, zmedico
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Calibre ebuild with use flag to select system/bundled BeautifulSoup

Description ukonkivi 2015-07-18 07:24:50 UTC
Created attachment 407048 [details]
Calibre ebuild with use flag to select system/bundled BeautifulSoup

Calibre plugins that depend on bundled BeautifulSoup don't seem to be working.
At least one such plugin is KoboUtilities, similarly written plugins probably suffer from the same problem.

Mine is set to update reading status on connect, this fails with the following:
calibre, version 2.31.0
ERROR: Unhandled exception: <b>ImportError</b>:No module named BeautifulSoup

calibre 2.31  isfrozen: False is64bit: True
Linux-3.19.3-gentoo-x86_64-Intel-R-_Core-TM-_i5_CPU_M_540_@_2.53GHz-with-gentoo-2.2 Linux ('64bit', 'ELF')
('Linux', '3.19.3-gentoo', '#1 SMP PREEMPT Sat Apr 4 08:07:12 EEST 2015')
Python 2.7.9
Linux: ('Gentoo Base System', '2.2', '')
Successfully initialized third party plugins: DeDRM && KoboTouchExtended && Generate Cover && Kobo Utilities && KePub Output && Goodreads
Traceback (most recent call last):
  File "calibre_plugins.koboutilities.dialogs", line 216, in do_books
  File "calibre_plugins.koboutilities.dialogs", line 262, in do_queue
  File "calibre_plugins.koboutilities.action", line 1950, in _store_queue_job
  File "/usr/lib64/calibre/calibre/customize/zipplugin.py", line 179, in load_module
    exec compiled in mod.__dict__
  File "calibre_plugins.koboutilities.jobs", line 21, in <module>
ImportError: No module named BeautifulSoup

The line 21 in question from jobs.py in the plugin archive:
from calibre.ebooks.BeautifulSoup import BeautifulStoneSoup

The bundled BeautifulSoup is removed in ebuild during src_prepare:
# use system beautifulsoup, instead of bundled
rm -f "${S}"/src/calibre/ebooks/BeautifulSoup.py \
	|| die "could not remove bundled beautifulsoup"
find "${S}" -type f -name \*.py -exec \
	sed -e 's/calibre.ebooks.BeautifulSoup/BeautifulSoup/' -i {} + \
	|| die "could not sed bundled beautifulsoup out of the source tree"

I tested with KoboUtilities plugin modified the same way and original ebuild (works), and original KoboUtilities plugin with modified ebuild (works).

I have no idea how common it is for plugins to import the bundled module this way, thus not a clue about the impact.

Attached the modified ebuild I used for testing.
Comment 1 Ben de Groot (RETIRED) gentoo-dev 2015-08-05 08:43:41 UTC
This seems to be a problem with the plugin, not really with our ebuild. I would vote for "WONTFIX".
Comment 2 ukonkivi 2015-08-06 18:47:35 UTC
Given that Calibre doesn't appear to present an option not to bundle BeautifulSoup, and the plugin expects to find it where it is bundled, I would still say the problem is caused by the ebuild expressly removing the bundled module. There is no problem with the plugin when used in a unmodified Calibre.
Comment 3 Jonas Stein gentoo-dev 2017-05-21 22:37:40 UTC
Is this problem still present in the latest version, or can we close this bug?
Comment 4 ukonkivi 2017-05-23 16:50:13 UTC
I did some quick testing and could not reproduce the problem using version 2.84.0 from Portage tree. Hopefully it stays that way.