Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-gfx/hydrus/files/, media-gfx/hydrus/
Date: Mon, 31 May 2021 14:11:45
Message-Id: 1622470292.964d7dde6015ceb12521877cab13a918d00cbfed.sam@gentoo
1 commit: 964d7dde6015ceb12521877cab13a918d00cbfed
2 Author: Ekaterina Vaartis <vaartis <AT> kotobank <DOT> ch>
3 AuthorDate: Fri May 7 15:01:51 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Mon May 31 14:11:32 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=964d7dde
7
8 media-gfx/hydrus: New package
9
10 Signed-off-by: Ekaterina Vaartis <vaartis <AT> kotobank.ch>
11 Closes: https://github.com/gentoo/gentoo/pull/20720
12 Signed-off-by: Sam James <sam <AT> gentoo.org>
13
14 media-gfx/hydrus/Manifest | 1 +
15 media-gfx/hydrus/files/hydrus-client | 3 +
16 media-gfx/hydrus/files/hydrus-server | 2 +
17 .../hydrus/files/userpath-in-local-share.patch | 12 ++
18 media-gfx/hydrus/hydrus-441.ebuild | 156 +++++++++++++++++++++
19 media-gfx/hydrus/metadata.xml | 26 ++++
20 6 files changed, 200 insertions(+)
21
22 diff --git a/media-gfx/hydrus/Manifest b/media-gfx/hydrus/Manifest
23 new file mode 100644
24 index 00000000000..0265c837b47
25 --- /dev/null
26 +++ b/media-gfx/hydrus/Manifest
27 @@ -0,0 +1 @@
28 +DIST hydrus-441.tar.gz 38807432 BLAKE2B e8294a8eb4d808792f2ff50ad4776f078ba1003962b065883ec22fd68f46dc250b2bccf47005731fcc964b75e07977aed45023da1c7e4513fcfcc29d1b4d1a97 SHA512 81eeb59006644b9b33c33c8da3e003640116488509ce2e1426d2a5c0161adf208e31a45c2a5efc2902769bf91e3db56aabc6384f77e8354e0e113bcc6df3a131
29
30 diff --git a/media-gfx/hydrus/files/hydrus-client b/media-gfx/hydrus/files/hydrus-client
31 new file mode 100644
32 index 00000000000..7a6e42747c5
33 --- /dev/null
34 +++ b/media-gfx/hydrus/files/hydrus-client
35 @@ -0,0 +1,3 @@
36 +#!/bin/sh
37 +export QT_API="${QT_API:-pyside2}"
38 +exec /usr/bin/python -OO /opt/hydrus/client.pyw "$@"
39
40 diff --git a/media-gfx/hydrus/files/hydrus-server b/media-gfx/hydrus/files/hydrus-server
41 new file mode 100644
42 index 00000000000..cecb9adc1a2
43 --- /dev/null
44 +++ b/media-gfx/hydrus/files/hydrus-server
45 @@ -0,0 +1,2 @@
46 +#!/bin/sh
47 +exec /usr/bin/python -OO /opt/hydrus/server.py "$@"
48
49 diff --git a/media-gfx/hydrus/files/userpath-in-local-share.patch b/media-gfx/hydrus/files/userpath-in-local-share.patch
50 new file mode 100644
51 index 00000000000..8b4c12be071
52 --- /dev/null
53 +++ b/media-gfx/hydrus/files/userpath-in-local-share.patch
54 @@ -0,0 +1,12 @@
55 +diff --git a/hydrus/core/HydrusConstants.py b/hydrus/core/HydrusConstants.py
56 +index 05fff23..d68fc06 100644
57 +--- a/hydrus/core/HydrusConstants.py
58 ++++ b/hydrus/core/HydrusConstants.py
59 +@@ -67,6 +67,7 @@ if USERPATH_DB_DIR == desired_userpath_db_dir:
60 +
61 + USERPATH_DB_DIR = None
62 +
63 ++USERPATH_DB_DIR = os.path.expanduser ( os.path.join( '~', '.local', 'share', 'hydrus', 'db' ) )
64 +
65 + LICENSE_PATH = os.path.join( BASE_DIR, 'license.txt' )
66 +
67
68 diff --git a/media-gfx/hydrus/hydrus-441.ebuild b/media-gfx/hydrus/hydrus-441.ebuild
69 new file mode 100644
70 index 00000000000..ae3f806847c
71 --- /dev/null
72 +++ b/media-gfx/hydrus/hydrus-441.ebuild
73 @@ -0,0 +1,156 @@
74 +# Copyright 1999-2021 Gentoo Authors
75 +# Distributed under the terms of the GNU General Public License v2
76 +
77 +EAPI=7
78 +
79 +PYTHON_COMPAT=( python3_{7..8} )
80 +PYTHON_REQ_USE="sqlite"
81 +
82 +inherit python-single-r1 desktop optfeature
83 +
84 +DESCRIPTION="A booru-like media organizer for the desktop"
85 +HOMEPAGE="http://hydrusnetwork.github.io/hydrus/ https://github.com/hydrusnetwork/hydrus"
86 +SRC_URI="https://github.com/hydrusnetwork/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
87 +
88 +# hydrus itself is WTFPL
89 +# icons included are CC-BY-2.5
90 +LICENSE="WTFPL-2 CC-BY-2.5"
91 +SLOT="0"
92 +KEYWORDS="~amd64"
93 +IUSE="+mpv +ffmpeg +lz4 socks +cloudscraper charts test"
94 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
95 +
96 +RESTRICT="!test? ( test )"
97 +
98 +RDEPEND="
99 + ${PYTHON_DEPS}
100 + $(python_gen_cond_dep '
101 + dev-python/chardet[${PYTHON_MULTI_USEDEP}]
102 + dev-python/html5lib[${PYTHON_MULTI_USEDEP}]
103 + dev-python/lxml[${PYTHON_MULTI_USEDEP}]
104 + dev-python/numpy[${PYTHON_MULTI_USEDEP}]
105 + dev-python/pillow[${PYTHON_MULTI_USEDEP}]
106 + dev-python/psutil[${PYTHON_MULTI_USEDEP}]
107 + dev-python/pyopenssl[${PYTHON_MULTI_USEDEP}]
108 + dev-python/pyside2[widgets,gui,charts?,${PYTHON_MULTI_USEDEP}]
109 + dev-python/pyyaml[${PYTHON_MULTI_USEDEP}]
110 + dev-python/requests[${PYTHON_MULTI_USEDEP}]
111 + dev-python/send2trash[${PYTHON_MULTI_USEDEP}]
112 + dev-python/service_identity[${PYTHON_MULTI_USEDEP}]
113 + dev-python/six[${PYTHON_MULTI_USEDEP}]
114 + dev-python/twisted[${PYTHON_MULTI_USEDEP}]
115 + media-libs/opencv[python,${PYTHON_MULTI_USEDEP}]
116 +
117 + >=dev-python/QtPy-1.9.0-r4[pyside2,${PYTHON_MULTI_USEDEP}]
118 + dev-python/beautifulsoup:4[${PYTHON_MULTI_USEDEP}]
119 +
120 + cloudscraper? ( dev-python/cloudscraper[${PYTHON_MULTI_USEDEP}] )
121 + ffmpeg? ( media-video/ffmpeg )
122 + lz4? ( dev-python/lz4[${PYTHON_MULTI_USEDEP}] )
123 + mpv? (
124 + media-video/mpv[libmpv,${PYTHON_MULTI_USEDEP}]
125 + dev-python/python-mpv[${PYTHON_MULTI_USEDEP}]
126 + )
127 + socks? (
128 + || ( dev-python/requests[socks5,${PYTHON_MULTI_USEDEP}]
129 + dev-python/PySocks[${PYTHON_MULTI_USEDEP}] )
130 + )
131 + ')
132 +"
133 +BDEPEND="
134 + ${RDEPEND}
135 + $(python_gen_cond_dep '
136 + test? (
137 + dev-python/httmock[${PYTHON_MULTI_USEDEP}]
138 + dev-python/mock[${PYTHON_MULTI_USEDEP}]
139 + dev-python/nose[${PYTHON_MULTI_USEDEP}]
140 + dev-python/unittest2[${PYTHON_MULTI_USEDEP}]
141 + )
142 + ')
143 +"
144 +
145 +PATCHES=(
146 + "${FILESDIR}/userpath-in-local-share.patch"
147 +)
148 +
149 +# Delete files only needed for testing
150 +delete_test_files() {
151 + rm test.py || die
152 + rm hydrus/hydrus_test.py || die
153 + rm -r hydrus/test/ || die
154 + rm -r static/testing/ || die
155 +}
156 +
157 +src_prepare() {
158 + default
159 +
160 + # If tests will run, leave the files until tests are run.
161 + # They will be deleted before installing the package.
162 + if ! use test; then
163 + delete_test_files
164 + fi
165 +
166 + # Contains pre-built binaries for other systems and a broken swf renderer for linux
167 + rm -r bin/ || die
168 + # Build files used for CI, not actually needed
169 + rm -r static/build_files || die
170 + # Duplicate license file, not needed
171 + rm license.txt || die
172 + # Python requirements files, not needed
173 + rm requirements_*.txt || die
174 +}
175 +
176 +src_compile() {
177 + python_optimize "${S}"
178 +}
179 +
180 +src_test() {
181 + # The tests use unittest, but are run with a custom runner script.
182 + # QT_QPA_PLATFORM is required to make them run without X
183 + export QT_QPA_PLATFORM=offscreen
184 + "${EPYTHON}" "${S}/test.py" || die "Tests failed"
185 +}
186 +
187 +src_install() {
188 + local DOC="${EPREFIX}/usr/share/doc/${PF}"
189 + elog "Hydrus includes an excellent manual, that can either be viewed at"
190 + elog "${DOC}/html/help/index.html"
191 + elog "or accessed through the hydrus help menu."
192 +
193 + mv "help my client will not boot.txt" "help_my_client_will_not_boot.txt" || die
194 +
195 + DOCS=(COPYING README.md Readme.txt help_my_client_will_not_boot.txt db/)
196 + HTML_DOCS=("${S}"/help/)
197 + einstalldocs
198 +
199 + if use test; then
200 + # Delete files only needed for tests now. No need to install them.
201 + # If the tests didn't run, the files have been deleted already.
202 + delete_test_files
203 + fi
204 +
205 + # These files are copied into DOC
206 + rm COPYING README.md Readme.txt help_my_client_will_not_boot.txt || die
207 + rm -r help/ db/ || die
208 + # The program expects to find documentation here, so add a symlink to DOC
209 + ln -s "${DOC}/html/help" help || die
210 +
211 + insopts -m0755
212 + insinto /opt/hydrus
213 + doins -r "${S}"/*
214 +
215 + exeinto /usr/bin
216 +
217 + sed "s/python/${EPYTHON}/" "${FILESDIR}/hydrus-server" > "${T}/hydrus-server" || die
218 + sed "s/python/${EPYTHON}/" "${FILESDIR}/hydrus-client" > "${T}/hydrus-client" || die
219 +
220 + python_doexe "${T}/hydrus-server"
221 + python_doexe "${T}/hydrus-client"
222 +
223 + make_desktop_entry "hydrus-client" "Hydrus Client" "/opt/hydrus/static/hydrus_non-transparent.png"\
224 + "AudioVideo;FileTools;Graphics;Network;"
225 +}
226 +
227 +pkg_postinst() {
228 + optfeature "support for automatic port forwarding" "net-libs/miniupnpc"
229 +}
230
231 diff --git a/media-gfx/hydrus/metadata.xml b/media-gfx/hydrus/metadata.xml
232 new file mode 100644
233 index 00000000000..0b2b3b92808
234 --- /dev/null
235 +++ b/media-gfx/hydrus/metadata.xml
236 @@ -0,0 +1,26 @@
237 +<?xml version="1.0" encoding="UTF-8"?>
238 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
239 +<pkgmetadata>
240 + <maintainer type="person" proxied="yes">
241 + <email>vaartis@××××××××.ch</email>
242 + <name>Ekaterina Vaartis</name>
243 + </maintainer>
244 + <maintainer type="project" proxied="proxy">
245 + <email>proxy-maint@g.o</email>
246 + <name>Proxy Maintainers</name>
247 + </maintainer>
248 + <longdescription>
249 + The hydrus network client is an application written for those who have large image/swf/webm collections. It browses
250 + with tags instead of folders, a little like a booru on your desktop. Advanced users can share tags and files
251 + anonymously through custom servers that any user may run
252 + </longdescription>
253 + <use>
254 + <flag name="charts">Support for bandwidth charts</flag>
255 + <flag name="cloudscraper">Support working around cloudflare anti-bot page</flag>
256 + <flag name="ffmpeg">Show duration and other information on video thumbnails</flag>
257 + <flag name="lz4">Enable memory compression in the client</flag>
258 + <flag name="mpv">Support playing videos with libmpv</flag>
259 + <flag name="socks">Support SOCKS proxies</flag>
260 + </use>
261 + <stabilize-allarches/>
262 +</pkgmetadata>