summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Serajnik2021-08-05 19:04:02 +0200
committerMichael Serajnik2021-08-05 19:04:02 +0200
commit10a3646256b28eab4aa3b41be100a4af4fabbfec (patch)
treeb127135777aaad934778f3f87290370f2e0a0494
downloadaur-10a3646256b28eab4aa3b41be100a4af4fabbfec.tar.gz
Add initial version
-rw-r--r--.SRCINFO49
-rw-r--r--.gitignore9
-rw-r--r--PKGBUILD83
-rw-r--r--hydrus-client2
-rw-r--r--hydrus-server2
-rw-r--r--hydrus.desktop9
-rw-r--r--hydrus.install12
-rw-r--r--paths-in-opt.patch93
8 files changed, 259 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..475068cdbbe5
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,49 @@
+pkgbase = hydrus-git
+ pkgdesc = Danbooru-like image tagging and searching system for the desktop
+ pkgver = 448.r0.g212088ba
+ pkgrel = 1
+ url = http://hydrusnetwork.github.io/hydrus/
+ install = hydrus.install
+ arch = any
+ license = WTFPL
+ makedepends = git
+ depends = python
+ depends = python-opencv
+ depends = python-beautifulsoup4
+ depends = python-yaml
+ depends = python-lz4>=0.10.1
+ depends = python-numpy
+ depends = python-twisted
+ depends = python-pillow
+ depends = python-pysocks
+ depends = python-psutil
+ depends = python-send2trash
+ depends = python-html5lib
+ depends = python-requests
+ depends = python-qtpy
+ depends = emoji-font
+ depends = python-mpv
+ depends = qt5-python-bindings
+ optdepends = ffmpeg: show duration and other information on video thumbnails
+ optdepends = miniupnpc: automatic port forwarding
+ optdepends = desktop-file-utils: to add Hydrus to your desktop environment menus
+ optdepends = python-cloudscraper: bypass cloudflare "checking your browser" challenges
+ optdepends = python-pyqt5-chart: display bandwidth usage charts
+ optdepends = python-pyopenssl: to generate certificates for accessing client API and server via HTTPS
+ provides = hydrus
+ conflicts = hydrus
+ conflicts = hydrus-docs
+ conflicts = hydrus-sources
+ options = !strip
+ source = git+https://github.com/hydrusnetwork/hydrus.git
+ source = paths-in-opt.patch
+ source = hydrus-client
+ source = hydrus-server
+ source = hydrus.desktop
+ sha256sums = SKIP
+ sha256sums = 6dde03b452b842d089cfdffb4cf8554b4985934d664054b2bb71006694f923c6
+ sha256sums = d2cb826ce0dd1892ab95fc3b14dbe6bd312210f653d0aea31938eeb7e361fdc5
+ sha256sums = 463841cc16059b516cc327cfbc30d3383e2236b085ba2d503e82f5be39444806
+ sha256sums = 9b8c2603a8040ae80152ff9a718ad3e8803fdc3029a939e3c0e932ea35ded923
+
+pkgname = hydrus-git
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..ba7e5d46ea8f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+# Hydrus git repo
+hydrus
+
+# makepkg working directories
+pkg
+src
+
+# Built packages
+*-*.pkg.tar*
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..5000cee9650f
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,83 @@
+# Maintainer: Michael Serajnik <m at mser dot at>
+DOC_DIRS=("opt/hydrus/help")
+pkgname=hydrus-git
+_pkgname=hydrus
+pkgver=448.r0.g212088ba
+pkgrel=1
+pkgdesc="Danbooru-like image tagging and searching system for the desktop"
+arch=("any")
+url="http://hydrusnetwork.github.io/hydrus/"
+license=("WTFPL")
+depends=("python" "python-opencv" "python-beautifulsoup4" "python-yaml"
+ "python-lz4>=0.10.1" "python-numpy" "python-twisted" "python-pillow"
+ "python-pysocks" "python-psutil" "python-send2trash" "python-html5lib"
+ "python-requests" "python-qtpy" "emoji-font" "python-mpv"
+ "qt5-python-bindings")
+makedepends=("git")
+optdepends=("ffmpeg: show duration and other information on video thumbnails"
+ "miniupnpc: automatic port forwarding"
+ "desktop-file-utils: to add Hydrus to your desktop environment menus"
+ "python-cloudscraper: bypass cloudflare \"checking your browser\" challenges"
+ "python-pyqt5-chart: display bandwidth usage charts"
+ "python-pyopenssl: to generate certificates for accessing client API and server via HTTPS")
+options=(!strip) # Don't strip libs because there aren't any
+install="hydrus.install"
+provides=("hydrus")
+conflicts=("hydrus" "hydrus-docs" "hydrus-sources")
+source=("git+https://github.com/hydrusnetwork/${_pkgname}.git"
+ "paths-in-opt.patch"
+ "hydrus-client"
+ "hydrus-server"
+ "hydrus.desktop")
+sha256sums=("SKIP"
+ "6dde03b452b842d089cfdffb4cf8554b4985934d664054b2bb71006694f923c6"
+ "d2cb826ce0dd1892ab95fc3b14dbe6bd312210f653d0aea31938eeb7e361fdc5"
+ "463841cc16059b516cc327cfbc30d3383e2236b085ba2d503e82f5be39444806"
+ "9b8c2603a8040ae80152ff9a718ad3e8803fdc3029a939e3c0e932ea35ded923")
+
+pkgver() {
+ cd "${srcdir}/${_pkgname}"
+ git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
+}
+
+prepare() {
+ cd "${srcdir}/${_pkgname}"
+ git apply < ../paths-in-opt.patch
+
+ # Remove unit tests
+ rm -f "hydrus/Test"*.py
+ rm -rf "static/testing"
+}
+
+build() {
+ cd "${srcdir}/${_pkgname}"
+
+ echo "Compiling .py files..."
+ python -OO -m compileall -fq .
+}
+
+package() {
+ cd "${srcdir}/${_pkgname}"
+
+ # Create /opt/hydrus and copy hydrus files to there
+ install -m755 -d "${pkgdir}/opt/hydrus"
+ cp -r help hydrus static client.pyw server.py "${pkgdir}/opt/hydrus/"
+
+ # Create and populate /opt/hydrus/bin
+ install -d -m755 "${pkgdir}/opt/hydrus/bin"
+ ln -s /usr/bin/upnpc "${pkgdir}/opt/hydrus/bin/upnpc_linux"
+ ln -s /usr/bin/ffmpeg "${pkgdir}/opt/hydrus/bin/ffmpeg"
+
+ # Install hydrus-client and hydrus-server executables
+ install -d -m755 "${pkgdir}/usr/bin"
+ install -m755 ../hydrus-{client,server} "${pkgdir}/usr/bin/"
+
+ # Install .desktop shortcut
+ install -d -m755 "${pkgdir}/usr/share/applications"
+ install -m644 ../hydrus.desktop "${pkgdir}/usr/share/applications/${_pkgname}.desktop"
+
+ # Install license files
+ install -d -m755 "${pkgdir}/usr/share/licenses/${_pkgname}"
+ install -m644 COPYING "${pkgdir}/usr/share/licenses/${_pkgname}/"
+ install -m644 license.txt "${pkgdir}/usr/share/licenses/${_pkgname}/"
+}
diff --git a/hydrus-client b/hydrus-client
new file mode 100644
index 000000000000..16b14ba225f3
--- /dev/null
+++ b/hydrus-client
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec python -OO /opt/hydrus/client.pyw "$@"
diff --git a/hydrus-server b/hydrus-server
new file mode 100644
index 000000000000..ea3cd3fce25a
--- /dev/null
+++ b/hydrus-server
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec python -OO /opt/hydrus/server.py "$@"
diff --git a/hydrus.desktop b/hydrus.desktop
new file mode 100644
index 000000000000..17b1cdd3112b
--- /dev/null
+++ b/hydrus.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Version=1.0
+Name=Hydrus Client
+Comment=A booru-like media organizer for the desktop
+Exec=hydrus-client
+Icon=/opt/hydrus/static/hydrus_non-transparent.png
+Terminal=false
+Type=Application
+Categories=Application;FileTools;Graphics;Network;
diff --git a/hydrus.install b/hydrus.install
new file mode 100644
index 000000000000..27c282a04440
--- /dev/null
+++ b/hydrus.install
@@ -0,0 +1,12 @@
+post_install() {
+ # Ignore failures because it's only an opt dep
+ update-desktop-database -q 2>/dev/null || :
+}
+
+post_upgrade() {
+ post_install
+}
+
+post_remove() {
+ post_install
+}
diff --git a/paths-in-opt.patch b/paths-in-opt.patch
new file mode 100644
index 000000000000..64ec3007c32a
--- /dev/null
+++ b/paths-in-opt.patch
@@ -0,0 +1,93 @@
+diff --git a/hydrus/client/gui/ClientGUI.py b/hydrus/client/gui/ClientGUI.py
+index 418c93e..91e2683 100644
+--- a/hydrus/client/gui/ClientGUI.py
++++ b/hydrus/client/gui/ClientGUI.py
+@@ -4133,7 +4133,7 @@ class FrameGUI( ClientGUITopLevelWindows.MainFrameThatResizes ):
+ python_executable = python_executable.replace( 'pythonw', 'python' )
+
+
+- server_script_path = os.path.join( HC.BASE_DIR, 'server.py' )
++ server_script_path = '/opt/hydrus/server.py'
+
+ cmd = [ python_executable, server_script_path, db_param ]
+
+diff --git a/hydrus/core/HydrusConstants.py b/hydrus/core/HydrusConstants.py
+index db6a88b..49e5fdb 100644
+--- a/hydrus/core/HydrusConstants.py
++++ b/hydrus/core/HydrusConstants.py
+@@ -5,33 +5,9 @@ import typing
+ # old method of getting frozen dir, doesn't work for symlinks looks like:
+ # BASE_DIR = getattr( sys, '_MEIPASS', None )
+
+-RUNNING_FROM_FROZEN_BUILD = getattr( sys, 'frozen', False )
+-
+-if RUNNING_FROM_FROZEN_BUILD:
+-
+- real_exe_path = os.path.realpath( sys.executable )
+-
+- BASE_DIR = os.path.dirname( real_exe_path )
+-
+-else:
+-
+- try:
+-
+- hc_realpath_dir = os.path.dirname( os.path.realpath( __file__ ) )
+-
+- HYDRUS_MODULE_DIR = os.path.split( hc_realpath_dir )[0]
+-
+- BASE_DIR = os.path.split( HYDRUS_MODULE_DIR )[0]
+-
+- except NameError: # if __file__ is not defined due to some weird OS
+-
+- BASE_DIR = os.path.realpath( sys.path[0] )
+-
+-
+- if BASE_DIR == '':
+-
+- BASE_DIR = os.getcwd()
+-
++RUNNING_FROM_FROZEN_BUILD = False
++HYDRUS_MODULE_DIR = '/opt/hydrus/hydrus'
++BASE_DIR = os.path.expanduser("~/.local/share/hydrus")
+
+ muh_platform = sys.platform.lower()
+
+@@ -43,32 +19,16 @@ PLATFORM_HAIKU = muh_platform == 'haiku1'
+ RUNNING_FROM_SOURCE = sys.argv[0].endswith( '.py' ) or sys.argv[0].endswith( '.pyw' )
+ RUNNING_FROM_MACOS_APP = os.path.exists( os.path.join( BASE_DIR, 'running_from_app' ) )
+
+-BIN_DIR = os.path.join( BASE_DIR, 'bin' )
+-HELP_DIR = os.path.join( BASE_DIR, 'help' )
+-INCLUDE_DIR = os.path.join( BASE_DIR, 'include' )
+-STATIC_DIR = os.path.join( BASE_DIR, 'static' )
++BIN_DIR = "/opt/hydrus/bin"
++HELP_DIR = "/opt/hydrus/help"
++INCLUDE_DIR = "/opt/hydrus/include"
++STATIC_DIR = "/opt/hydrus/static"
+
+ DEFAULT_DB_DIR = os.path.join( BASE_DIR, 'db' )
+
+-if PLATFORM_MACOS:
+-
+- desired_userpath_db_dir = os.path.join( '~', 'Library', 'Hydrus' )
+-
+-else:
+-
+- desired_userpath_db_dir = os.path.join( '~', 'Hydrus' )
+-
+-
+-USERPATH_DB_DIR = os.path.expanduser( desired_userpath_db_dir )
+-
+-if USERPATH_DB_DIR == desired_userpath_db_dir:
+-
+- # could not figure it out, probably a crazy user situation atm
+-
+- USERPATH_DB_DIR = None
+-
++USERPATH_DB_DIR = DEFAULT_DB_DIR
+
+-LICENSE_PATH = os.path.join( BASE_DIR, 'license.txt' )
++LICENSE_PATH = "/usr/share/licenses/hydrus/license.txt"
+
+ #
+