1 |
commit: 63d5384e4204ea4b9c8bc03b2e885029107ca8d9 |
2 |
Author: Nicholas Meyer <nickaristocrates <AT> gmail <DOT> com> |
3 |
AuthorDate: Fri Jan 24 18:30:27 2020 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Jan 25 08:47:24 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=63d5384e |
7 |
|
8 |
app-text/calibre: 4.9.1-r1 revbump for python3 support |
9 |
|
10 |
Closes: https://github.com/gentoo/gentoo/pull/14427 |
11 |
Closes: https://bugs.gentoo.org/702676 |
12 |
Signed-off-by: Nicholas Meyer <nickaristocrates <AT> gmail.com> |
13 |
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> |
14 |
|
15 |
app-text/calibre/calibre-4.9.1-r1.ebuild | 269 +++++++++++++++++++++++++++++++ |
16 |
1 file changed, 269 insertions(+) |
17 |
|
18 |
diff --git a/app-text/calibre/calibre-4.9.1-r1.ebuild b/app-text/calibre/calibre-4.9.1-r1.ebuild |
19 |
new file mode 100644 |
20 |
index 00000000000..a158ed8ff2e |
21 |
--- /dev/null |
22 |
+++ b/app-text/calibre/calibre-4.9.1-r1.ebuild |
23 |
@@ -0,0 +1,269 @@ |
24 |
+# Copyright 1999-2020 Gentoo Authors |
25 |
+# Distributed under the terms of the GNU General Public License v2 |
26 |
+ |
27 |
+EAPI=7 |
28 |
+ |
29 |
+PYTHON_COMPAT=( python2_7 python3_{6,7} ) |
30 |
+PYTHON_REQ_USE="sqlite,ssl" |
31 |
+ |
32 |
+inherit bash-completion-r1 desktop toolchain-funcs python-single-r1 xdg-utils |
33 |
+ |
34 |
+DESCRIPTION="Ebook management application" |
35 |
+HOMEPAGE="https://calibre-ebook.com/" |
36 |
+SRC_URI="https://download.calibre-ebook.com/${PV}/${P}.tar.xz" |
37 |
+ |
38 |
+LICENSE=" |
39 |
+ GPL-3+ |
40 |
+ GPL-3 |
41 |
+ GPL-2+ |
42 |
+ GPL-2 |
43 |
+ GPL-1+ |
44 |
+ LGPL-3+ |
45 |
+ LGPL-2.1+ |
46 |
+ LGPL-2.1 |
47 |
+ BSD |
48 |
+ MIT |
49 |
+ Old-MIT |
50 |
+ Apache-2.0 |
51 |
+ public-domain |
52 |
+ || ( Artistic GPL-1+ ) |
53 |
+ CC-BY-3.0 |
54 |
+ OFL-1.1 |
55 |
+ PSF-2 |
56 |
+" |
57 |
+KEYWORDS="~amd64 ~arm ~x86" |
58 |
+SLOT="0" |
59 |
+IUSE="ios +udisks" |
60 |
+ |
61 |
+REQUIRED_USE="${PYTHON_REQUIRED_USE}" |
62 |
+ |
63 |
+COMMON_DEPEND="${PYTHON_DEPS} |
64 |
+ >=app-text/hunspell-1.7:= |
65 |
+ >=app-text/podofo-0.9.6_pre20171027:= |
66 |
+ >=app-text/poppler-0.26.5[qt5] |
67 |
+ >=dev-libs/chmlib-0.40:= |
68 |
+ dev-libs/glib:2= |
69 |
+ dev-libs/hyphen:= |
70 |
+ >=dev-libs/icu-57.1:= |
71 |
+ dev-libs/libinput:= |
72 |
+ >=dev-python/apsw-3.25.2_p1[${PYTHON_USEDEP}] |
73 |
+ dev-python/beautifulsoup:4[${PYTHON_USEDEP}] |
74 |
+ >=dev-python/chardet-3.0.3[${PYTHON_USEDEP}] |
75 |
+ >=dev-python/cssselect-0.7.1[${PYTHON_USEDEP}] |
76 |
+ >=dev-python/css-parser-1.0.4[${PYTHON_USEDEP}] |
77 |
+ >=dev-python/dbus-python-1.2.4[${PYTHON_USEDEP}] |
78 |
+ >=dev-libs/dbus-glib-0.106 |
79 |
+ >=sys-apps/dbus-1.10.8 |
80 |
+ dev-python/dnspython[${PYTHON_USEDEP}] |
81 |
+ >=dev-python/feedparser-5.2.1[${PYTHON_USEDEP}] |
82 |
+ >=dev-python/html2text-2019.8.11[${PYTHON_USEDEP}] |
83 |
+ >=dev-python/html5-parser-0.4.9[${PYTHON_USEDEP}] |
84 |
+ >=dev-python/lxml-3.8.0[${PYTHON_USEDEP}] |
85 |
+ >=dev-python/markdown-3.0.1[${PYTHON_USEDEP}] |
86 |
+ >=dev-python/mechanize-0.3.5[${PYTHON_USEDEP}] |
87 |
+ >=dev-python/msgpack-0.5.6[${PYTHON_USEDEP}] |
88 |
+ >=dev-python/netifaces-0.10.5[${PYTHON_USEDEP}] |
89 |
+ >=dev-python/pillow-3.2.0[${PYTHON_USEDEP}] |
90 |
+ >=dev-python/psutil-4.3.0[${PYTHON_USEDEP}] |
91 |
+ >=dev-python/pygments-2.3.1[${PYTHON_USEDEP}] |
92 |
+ >=dev-python/python-dateutil-2.5.3[${PYTHON_USEDEP}] |
93 |
+ >=dev-python/PyQt5-5.12[gui,svg,widgets,network,printsupport,${PYTHON_USEDEP}] |
94 |
+ >=dev-python/PyQtWebEngine-5.12[${PYTHON_USEDEP}] |
95 |
+ dev-python/regex[${PYTHON_USEDEP}] |
96 |
+ dev-qt/qtcore:5= |
97 |
+ dev-qt/qtdbus:5= |
98 |
+ dev-qt/qtgui:5= |
99 |
+ >=dev-qt/qtwebengine-5.12 |
100 |
+ dev-qt/qtwidgets:5= |
101 |
+ dev-util/desktop-file-utils |
102 |
+ dev-util/gtk-update-icon-cache |
103 |
+ media-fonts/liberation-fonts |
104 |
+ media-libs/fontconfig:= |
105 |
+ >=media-libs/freetype-2:= |
106 |
+ >=media-libs/libmtp-1.1.11:= |
107 |
+ >=media-libs/libwmf-0.2.8 |
108 |
+ >=media-gfx/optipng-0.7.6 |
109 |
+ >=sys-libs/zlib-1.2.11:= |
110 |
+ virtual/libusb:1= |
111 |
+ x11-libs/libxkbcommon:= |
112 |
+ x11-libs/libX11:= |
113 |
+ x11-libs/libXext:= |
114 |
+ x11-libs/libXrender:= |
115 |
+ x11-misc/shared-mime-info |
116 |
+ >=x11-misc/xdg-utils-1.0.2-r2 |
117 |
+ ios? ( |
118 |
+ >=app-pda/usbmuxd-1.0.8 |
119 |
+ >=app-pda/libimobiledevice-1.2.0 |
120 |
+ ) |
121 |
+ udisks? ( virtual/libudev )" |
122 |
+RDEPEND="${COMMON_DEPEND} |
123 |
+ udisks? ( || ( sys-fs/udisks:2 sys-fs/udisks:0 ) )" |
124 |
+DEPEND="${COMMON_DEPEND} |
125 |
+ >=dev-python/setuptools-23.1.0[${PYTHON_USEDEP}] |
126 |
+ dev-python/sip[${PYTHON_USEDEP}] |
127 |
+ >=virtual/podofo-build-0.9.6_pre20171027 |
128 |
+ virtual/pkgconfig" |
129 |
+ |
130 |
+pkg_pretend() { |
131 |
+ if [[ ${MERGE_TYPE} != binary && $(gcc-major-version) -lt 6 ]]; then |
132 |
+ eerror "Calibre cannot be built with this version of gcc." |
133 |
+ eerror "You need at least gcc-6.0" |
134 |
+ die "Your C compiler is too old for this package." |
135 |
+ fi |
136 |
+} |
137 |
+ |
138 |
+src_prepare() { |
139 |
+ # no_updates: do not annoy user with "new version is availible all the time |
140 |
+ # disable_plugins: walking sec-hole, wait for upstream to use GHNS interface |
141 |
+ eapply \ |
142 |
+ "${FILESDIR}/${PN}-2.9.0-no_updates_dialog.patch" \ |
143 |
+ "${FILESDIR}/${PN}-disable_plugins.patch" |
144 |
+ |
145 |
+ eapply_user |
146 |
+ |
147 |
+ # Fix outdated version constant. |
148 |
+ #sed -e "s#\\(^numeric_version =\\).*#\\1 (${PV//./, })#" \ |
149 |
+ # -i src/calibre/constants.py || \ |
150 |
+ # die "sed failed to patch constants.py" |
151 |
+ |
152 |
+ # Avoid sandbox violation in /usr/share/gnome/apps when linux.py |
153 |
+ # calls xdg-* (bug #258938). |
154 |
+ sed -e "s|'xdg-desktop-menu', 'install'|\\0, '--mode', 'user'|" \ |
155 |
+ -e "s|check_call(\\['xdg-desktop-menu', 'forceupdate'\\])|#\\0|" \ |
156 |
+ -e "s|\\(CurrentDir(tdir)\\), \\\\\$|\\1:|" \ |
157 |
+ -e "s|, PreserveMIMEDefaults():|:|" \ |
158 |
+ -e "s|'xdg-icon-resource', 'install'|\\0, '--mode', 'user'|" \ |
159 |
+ -e "s|cmd\[2\]|cmd[4]|" \ |
160 |
+ -e "s|cc(\\['xdg-desktop-menu', 'forceupdate'\\])|#\\0|" \ |
161 |
+ -e "s|'xdg-mime', 'install'|\\0, '--mode', 'user'|" \ |
162 |
+ -i src/calibre/linux.py || die "sed failed to patch linux.py" |
163 |
+ |
164 |
+ # Disable unnecessary privilege dropping for bug #287067. |
165 |
+ sed -e "s:if os.geteuid() == 0:if False and os.geteuid() == 0:" \ |
166 |
+ -i setup/install.py || die "sed failed to patch install.py" |
167 |
+ |
168 |
+ sed -e "/^ self.check_call(\\[QMAKE\\] + qmc + \\[proname\\])$/a\ |
169 |
+\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ self.check_call(['sed', \ |
170 |
+'-e', 's|^CFLAGS .*|\\\\\\\\0 ${CFLAGS}|', \ |
171 |
+'-e', 's|^CXXFLAGS .*|\\\\\\\\0 ${CXXFLAGS}|', \ |
172 |
+'-e', 's|^LFLAGS .*|\\\\\\\\0 ${LDFLAGS}|', \ |
173 |
+'-i', 'Makefile'])" \ |
174 |
+ -i setup/build.py || die "sed failed to patch build.py" |
175 |
+} |
176 |
+ |
177 |
+src_install() { |
178 |
+ # calibre works with python 3, so remove the python 2 constraint |
179 |
+ export CALIBRE_PY3_PORT=1 |
180 |
+ |
181 |
+ # Bypass kbuildsycoca and update-mime-database in order to |
182 |
+ # avoid sandbox violations if xdg-mime tries to call them. |
183 |
+ cat - > "${T}/kbuildsycoca" <<-EOF |
184 |
+ #!${BASH} |
185 |
+ echo $0 : $@ |
186 |
+ exit 0 |
187 |
+ EOF |
188 |
+ |
189 |
+ cp "${T}"/{kbuildsycoca,update-mime-database} || die |
190 |
+ chmod +x "${T}"/{kbuildsycoca,update-mime-database} || die |
191 |
+ |
192 |
+ export QMAKE="${EPREFIX}/usr/$(get_libdir)/qt5/bin/qmake" |
193 |
+ |
194 |
+ # Unset DISPLAY in order to prevent xdg-mime from triggering a sandbox |
195 |
+ # violation with kbuildsycoca as in bug #287067, comment #13. |
196 |
+ export -n DISPLAY |
197 |
+ |
198 |
+ # Bug #352625 - Some LANGUAGE values can trigger the following ValueError: |
199 |
+ # File "/usr/lib/python2.6/locale.py", line 486, in getdefaultlocale |
200 |
+ # return _parse_localename(localename) |
201 |
+ # File "/usr/lib/python2.6/locale.py", line 418, in _parse_localename |
202 |
+ # raise ValueError, 'unknown locale: %s' % localename |
203 |
+ #ValueError: unknown locale: 46 |
204 |
+ export -n LANG LANGUAGE ${!LC_*} |
205 |
+ export LC_ALL=C #684484 |
206 |
+ |
207 |
+ # Bug #295672 - Avoid sandbox violation in ~/.config by forcing |
208 |
+ # variables to point to our fake temporary $HOME. |
209 |
+ export HOME="${T}/fake_homedir" |
210 |
+ export XDG_CONFIG_HOME="${HOME}/.config" |
211 |
+ export XDG_DATA_HOME="${HOME}/.local/share" |
212 |
+ export CALIBRE_CONFIG_DIRECTORY="${XDG_CONFIG_HOME}/calibre" |
213 |
+ mkdir -p "${XDG_DATA_HOME}" "${CALIBRE_CONFIG_DIRECTORY}" || die |
214 |
+ |
215 |
+ tc-export CC CXX |
216 |
+ # Bug #334243 - respect LDFLAGS when building extensions |
217 |
+ export OVERRIDE_CFLAGS="$CFLAGS" OVERRIDE_LDFLAGS="$LDFLAGS" |
218 |
+ local libdir=$(get_libdir) |
219 |
+ [[ -n $libdir ]] || die "get_libdir returned an empty string" |
220 |
+ |
221 |
+ addpredict /dev/dri #665310 |
222 |
+ |
223 |
+ PATH=${T}:${PATH} PYTHONPATH=${S}/src${PYTHONPATH:+:}${PYTHONPATH} \ |
224 |
+ "${PYTHON}" setup.py install \ |
225 |
+ --root="${D}" \ |
226 |
+ --prefix="${EPREFIX}/usr" \ |
227 |
+ --libdir="${EPREFIX}/usr/${libdir}" \ |
228 |
+ --staging-root="${ED}/usr" \ |
229 |
+ --staging-libdir="${ED}/usr/${libdir}" || die |
230 |
+ |
231 |
+ rm "${ED}/usr/share/applications/defaults.list" || die |
232 |
+ find "${ED}"/usr/share -type d -empty -delete |
233 |
+ |
234 |
+ cd "${ED}"/usr/share/calibre/fonts/liberation || die |
235 |
+ local x |
236 |
+ for x in * ; do |
237 |
+ [[ -f ${EPREFIX}usr/share/fonts/liberation-fonts/${x} ]] || continue |
238 |
+ ln -sf "../../../fonts/liberation-fonts/${x}" "${x}" || die |
239 |
+ done |
240 |
+ |
241 |
+ einfo "Converting python shebangs" |
242 |
+ python_fix_shebang --force "${ED}" |
243 |
+ |
244 |
+ einfo "Compiling python modules" |
245 |
+ python_optimize "${ED}"/usr/lib/calibre |
246 |
+ |
247 |
+ newinitd "${FILESDIR}"/calibre-server-3.init calibre-server |
248 |
+ newconfd "${FILESDIR}"/calibre-server-3.conf calibre-server |
249 |
+ |
250 |
+ bashcomp_alias calibre \ |
251 |
+ lrfviewer \ |
252 |
+ calibre-debug \ |
253 |
+ ebook-meta \ |
254 |
+ calibre-server \ |
255 |
+ ebook-viewer \ |
256 |
+ ebook-polish \ |
257 |
+ fetch-ebook-metadata \ |
258 |
+ lrf2lrs \ |
259 |
+ ebook-convert \ |
260 |
+ ebook-edit \ |
261 |
+ calibre-smtp \ |
262 |
+ ebook-device |
263 |
+ |
264 |
+} |
265 |
+ |
266 |
+pkg_preinst() { |
267 |
+ # Indentify stray directories from upstream's "Binary install" |
268 |
+ # method (see bug 622728). |
269 |
+ CALIBRE_LIB_DIR=/usr/$(get_libdir)/calibre |
270 |
+ CALIBRE_LIB_CONTENT=$(for x in "${ED}${CALIBRE_LIB_DIR}"/*; do |
271 |
+ printf -- "${x##*/} "; done) || die "Failed to list ${ED}${CALIBRE_LIB_DIR}" |
272 |
+} |
273 |
+ |
274 |
+pkg_postinst() { |
275 |
+ [[ -n ${CALIBRE_LIB_DIR} ]] || die "CALIBRE_LIB_DIR is unset" |
276 |
+ local x |
277 |
+ for x in "${EROOT}${CALIBRE_LIB_DIR}"/*; do |
278 |
+ if [[ " ${CALIBRE_LIB_CONTENT} " != *" ${x##*/} "* ]]; then |
279 |
+ elog "Purging '${x}'" |
280 |
+ rm -rf "${x}" |
281 |
+ fi |
282 |
+ done |
283 |
+ xdg_desktop_database_update |
284 |
+ xdg_mimeinfo_database_update |
285 |
+ xdg_icon_cache_update |
286 |
+} |
287 |
+ |
288 |
+pkg_postrm() { |
289 |
+ xdg_desktop_database_update |
290 |
+ xdg_mimeinfo_database_update |
291 |
+ xdg_icon_cache_update |
292 |
+} |