1 |
commit: e2488d93b0267444a7e14c52da34e31ec0b97e18 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Feb 9 20:46:19 2020 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Feb 9 20:50:24 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e2488d93 |
7 |
|
8 |
app-text/calibre: kobo py3 fix for bug 708742 |
9 |
|
10 |
Closes: https://bugs.gentoo.org/708742 |
11 |
Package-Manager: Portage-2.3.88, Repoman-2.3.20 |
12 |
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> |
13 |
|
14 |
...e-4.10.1-r1.ebuild => calibre-4.10.1-r2.ebuild} | 3 +- |
15 |
...bre-4.9.1-r1.ebuild => calibre-4.9.1-r2.ebuild} | 3 +- |
16 |
...Ignore-TypeError-sorting-collections-kobo.patch | 63 ++++++++++++++++++++++ |
17 |
3 files changed, 67 insertions(+), 2 deletions(-) |
18 |
|
19 |
diff --git a/app-text/calibre/calibre-4.10.1-r1.ebuild b/app-text/calibre/calibre-4.10.1-r2.ebuild |
20 |
similarity index 98% |
21 |
rename from app-text/calibre/calibre-4.10.1-r1.ebuild |
22 |
rename to app-text/calibre/calibre-4.10.1-r2.ebuild |
23 |
index 87653101234..2004b89741d 100644 |
24 |
--- a/app-text/calibre/calibre-4.10.1-r1.ebuild |
25 |
+++ b/app-text/calibre/calibre-4.10.1-r2.ebuild |
26 |
@@ -121,7 +121,8 @@ src_prepare() { |
27 |
# disable_plugins: walking sec-hole, wait for upstream to use GHNS interface |
28 |
eapply \ |
29 |
"${FILESDIR}/${PN}-2.9.0-no_updates_dialog.patch" \ |
30 |
- "${FILESDIR}/${PN}-disable_plugins.patch" |
31 |
+ "${FILESDIR}/${PN}-disable_plugins.patch" \ |
32 |
+ "${FILESDIR}/${PN}-4.9.1-py3-Ignore-TypeError-sorting-collections-kobo.patch" |
33 |
|
34 |
eapply_user |
35 |
|
36 |
|
37 |
diff --git a/app-text/calibre/calibre-4.9.1-r1.ebuild b/app-text/calibre/calibre-4.9.1-r2.ebuild |
38 |
similarity index 98% |
39 |
rename from app-text/calibre/calibre-4.9.1-r1.ebuild |
40 |
rename to app-text/calibre/calibre-4.9.1-r2.ebuild |
41 |
index 10509962f2e..3718b23741e 100644 |
42 |
--- a/app-text/calibre/calibre-4.9.1-r1.ebuild |
43 |
+++ b/app-text/calibre/calibre-4.9.1-r2.ebuild |
44 |
@@ -121,7 +121,8 @@ src_prepare() { |
45 |
# disable_plugins: walking sec-hole, wait for upstream to use GHNS interface |
46 |
eapply \ |
47 |
"${FILESDIR}/${PN}-2.9.0-no_updates_dialog.patch" \ |
48 |
- "${FILESDIR}/${PN}-disable_plugins.patch" |
49 |
+ "${FILESDIR}/${PN}-disable_plugins.patch" \ |
50 |
+ "${FILESDIR}/${PN}-4.9.1-py3-Ignore-TypeError-sorting-collections-kobo.patch" |
51 |
|
52 |
eapply_user |
53 |
|
54 |
|
55 |
diff --git a/app-text/calibre/files/calibre-4.9.1-py3-Ignore-TypeError-sorting-collections-kobo.patch b/app-text/calibre/files/calibre-4.9.1-py3-Ignore-TypeError-sorting-collections-kobo.patch |
56 |
new file mode 100644 |
57 |
index 00000000000..fb55e0025b7 |
58 |
--- /dev/null |
59 |
+++ b/app-text/calibre/files/calibre-4.9.1-py3-Ignore-TypeError-sorting-collections-kobo.patch |
60 |
@@ -0,0 +1,63 @@ |
61 |
+From 6f947d88d323bb08bb6e076d442662aa281fe197 Mon Sep 17 00:00:00 2001 |
62 |
+From: Zac Medico <zmedico@g.o> |
63 |
+Date: Sun, 9 Feb 2020 12:16:04 -0800 |
64 |
+Subject: [PATCH] py3: Ignore TypeError when sorting device collections for |
65 |
+ kobo driver |
66 |
+ |
67 |
+https://github.com/kovidgoyal/calibre/pull/1098 |
68 |
+ |
69 |
+Use the same approach as the usbms driver when cmp raises a |
70 |
+TypeError (see a8deb4b1f8dfb768a32b95b1540be32d5d6e871e). |
71 |
+ |
72 |
+This should suppress the following error which was reported for |
73 |
+python3 and not python2: |
74 |
+ |
75 |
+Traceback (most recent call last): |
76 |
+ File "/usr/lib64/calibre/calibre/gui2/device.py", line 90, in run |
77 |
+ self.result = self.func(*self.args, **self.kwargs) |
78 |
+ File "/usr/lib64/calibre/calibre/gui2/device.py", line 543, in _sync_booklists |
79 |
+ self.device.sync_booklists(booklists, end_session=False) |
80 |
+ File "/usr/lib64/calibre/calibre/devices/kobo/driver.py", line 970, in sync_booklists |
81 |
+ self.update_device_database_collections(blist, collections, oncard) |
82 |
+ File "/usr/lib64/calibre/calibre/devices/kobo/driver.py", line 2398, in update_device_database_collections |
83 |
+ collections = booklists.get_collections(collections_attributes) if bookshelf_attribute else None |
84 |
+ File "/usr/lib64/calibre/calibre/devices/kobo/books.py", line 314, in get_collections |
85 |
+ books = sorted(itervalues(lpaths), key=cmp_to_key(none_cmp)) |
86 |
+ File "/usr/lib64/calibre/calibre/devices/kobo/books.py", line 307, in none_cmp |
87 |
+ c = cmp(x, y) |
88 |
+ File "/usr/lib64/calibre/polyglot/builtins.py", line 106, in cmp |
89 |
+ return (a > b) - (a < b) |
90 |
+TypeError: '>' not supported between instances of 'float' and 'str' |
91 |
+ |
92 |
+See: https://bugs.gentoo.org/708742 |
93 |
+--- |
94 |
+ src/calibre/devices/kobo/books.py | 10 ++++++++-- |
95 |
+ 1 file changed, 8 insertions(+), 2 deletions(-) |
96 |
+ |
97 |
+diff --git a/src/calibre/devices/kobo/books.py b/src/calibre/devices/kobo/books.py |
98 |
+index f725751d00..fc1dee6b7e 100644 |
99 |
+--- a/src/calibre/devices/kobo/books.py |
100 |
++++ b/src/calibre/devices/kobo/books.py |
101 |
+@@ -304,11 +304,17 @@ class KTCollectionsBookList(CollectionsBookList): |
102 |
+ return -1 |
103 |
+ if isinstance(x, string_or_bytes) and isinstance(y, string_or_bytes): |
104 |
+ x, y = sort_key(force_unicode(x)), sort_key(force_unicode(y)) |
105 |
+- c = cmp(x, y) |
106 |
++ try: |
107 |
++ c = cmp(x, y) |
108 |
++ except TypeError: |
109 |
++ c = 0 |
110 |
+ if c != 0: |
111 |
+ return c |
112 |
+ # same as above -- no sort_key needed here |
113 |
+- return cmp(xx[2], yy[2]) |
114 |
++ try: |
115 |
++ return cmp(xx[2], yy[2]) |
116 |
++ except TypeError: |
117 |
++ return 0 |
118 |
+ |
119 |
+ for category, lpaths in iteritems(collections): |
120 |
+ books = sorted(itervalues(lpaths), key=cmp_to_key(none_cmp)) |
121 |
+-- |
122 |
+2.24.1 |
123 |
+ |