Merge pull request #131298 from dali99/add_to_hydrus_maintainer

hydrus: Update and improve package
This commit is contained in:
Sandro 2021-07-24 20:55:36 +00:00 committed by GitHub
commit fbf61871ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 52 additions and 28 deletions

View file

@ -1,53 +1,56 @@
{ lib { lib
, fetchFromGitHub , fetchFromGitHub
, xz
, wrapQtAppsHook , wrapQtAppsHook
, miniupnpc_2 , miniupnpc_2
, ffmpeg
, enableSwftools ? false , enableSwftools ? false
, swftools , swftools
, pythonPackages , python3Packages
}: }:
pythonPackages.buildPythonPackage rec { python3Packages.buildPythonPackage rec {
pname = "hydrus"; pname = "hydrus";
version = "441"; version = "447";
format = "other"; format = "other";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "hydrusnetwork"; owner = "hydrusnetwork";
repo = "hydrus"; repo = "hydrus";
rev = "v${version}"; rev = "v${version}";
sha256 = "13h4qcz0iqba4mwyvgmdqh99jy22x7kw20f3g43b5aq3qyk9ca2h"; sha256 = "0a9nrsbw3w1229bm90xayixvkpvr6g338w64x4v75sqxvpbx84lz";
}; };
nativeBuildInputs = [ nativeBuildInputs = [
wrapQtAppsHook wrapQtAppsHook
]; ];
propagatedBuildInputs = with pythonPackages; [ propagatedBuildInputs = with python3Packages; [
beautifulsoup4 beautifulsoup4
chardet
cloudscraper
html5lib html5lib
lxml lxml
lz4
nose
numpy numpy
opencv4 opencv4
pillow pillow
psutil psutil
pylzma
pyopenssl pyopenssl
pyside2
pysocks
pythonPackages.mpv
pyyaml pyyaml
qtpy
requests requests
send2trash send2trash
service-identity service-identity
six
twisted twisted
lz4
xz
pysocks
matplotlib
qtpy
pyside2
mpv
]; ];
checkInputs = with pythonPackages; [ nose httmock ]; checkInputs = with python3Packages; [ nose mock httmock ];
# most tests are failing, presumably because we are not using test.py # most tests are failing, presumably because we are not using test.py
checkPhase = '' checkPhase = ''
@ -77,37 +80,34 @@ pythonPackages.buildPythonPackage rec {
outputs = [ "out" "doc" ]; outputs = [ "out" "doc" ];
postPatch = ''
sed 's;os\.path\.join(\sHC\.BIN_DIR,.*;"${miniupnpc_2}/bin/upnpc";' \
-i ./hydrus/core/networking/HydrusNATPunch.py
'' + lib.optionalString enableSwftools ''
sed 's;os\.path\.join(\sHC\.BIN_DIR,.*;"${swftools}/bin/swfrender";' \
-i ./hydrus/core/HydrusFlashHandling.py
'';
#doCheck = true;
installPhase = '' installPhase = ''
# Move the hydrus module and related directories # Move the hydrus module and related directories
mkdir -p $out/${pythonPackages.python.sitePackages} mkdir -p $out/${python3Packages.python.sitePackages}
mv {hydrus,static} $out/${pythonPackages.python.sitePackages} mv {hydrus,static} $out/${python3Packages.python.sitePackages}
mv help $out/doc/ mv help $out/doc/
# install the hydrus binaries # install the hydrus binaries
mkdir -p $out/bin mkdir -p $out/bin
install -m0755 server.py $out/bin/hydrus-server install -m0755 server.py $out/bin/hydrus-server
install -m0755 client.py $out/bin/hydrus-client install -m0755 client.py $out/bin/hydrus-client
'' + lib.optionalString enableSwftools ''
mkdir -p $out/${python3Packages.python.sitePackages}/bin
# swfrender seems to have to be called sfwrender_linux
# not sure if it can be loaded through PATH, but this is simpler
# $out/python3Packages.python.sitePackages/bin is correct NOT .../hydrus/bin
ln -s ${swftools}/bin/swfrender $out/${python3Packages.python.sitePackages}/bin/swfrender_linux
''; '';
dontWrapQtApps = true; dontWrapQtApps = true;
preFixup = '' preFixup = ''
makeWrapperArgs+=("''${qtWrapperArgs[@]}") makeWrapperArgs+=("''${qtWrapperArgs[@]}")
makeWrapperArgs+=(--prefix PATH : ${lib.makeBinPath [ ffmpeg miniupnpc_2 ]})
''; '';
meta = with lib; { meta = with lib; {
description = "Danbooru-like image tagging and searching system for the desktop"; description = "Danbooru-like image tagging and searching system for the desktop";
license = licenses.wtfpl; license = licenses.wtfpl;
homepage = "https://hydrusnetwork.github.io/hydrus/"; homepage = "https://hydrusnetwork.github.io/hydrus/";
maintainers = [ maintainers.evanjs ]; maintainers = with maintainers; [ dandellion evanjs ];
}; };
} }

View file

@ -0,0 +1,23 @@
{ lib, buildPythonPackage, fetchPypi }:
buildPythonPackage rec {
pname = "pylzma";
version = "0.5.0";
# This vendors an old LZMA SDK
# After some discussion, it seemed most reasonable to keep it that way
# xz, and uefi-firmware-parser also does this
src = fetchPypi {
inherit pname version;
sha256 = "074anvhyjgsv2iby2ql1ixfvjgmhnvcwjbdz8gk70xzkzcm1fx5q";
};
pythonImportsCheck = [ "pylzma" ];
meta = with lib; {
homepage = "https://www.joachim-bauch.de/projects/pylzma/";
description = "Platform independent python bindings for the LZMA compression library";
license = licenses.lgpl21Only;
maintainers = with maintainers; [ dandellion ];
};
}

View file

@ -19,7 +19,6 @@ stdenv.mkDerivation rec {
license = licenses.gpl2Only; license = licenses.gpl2Only;
maintainers = [ maintainers.koral ]; maintainers = [ maintainers.koral ];
platforms = lib.platforms.unix; platforms = lib.platforms.unix;
broken = true;
knownVulnerabilities = [ knownVulnerabilities = [
"CVE-2017-10976" "CVE-2017-10976"
"CVE-2017-11096" "CVE-2017-11096"

View file

@ -6215,6 +6215,8 @@ in {
pylxd = callPackage ../development/python-modules/pylxd { }; pylxd = callPackage ../development/python-modules/pylxd { };
pylzma = callPackage ../development/python-modules/pylzma { };
pymacaroons = callPackage ../development/python-modules/pymacaroons { }; pymacaroons = callPackage ../development/python-modules/pymacaroons { };
pymaging = callPackage ../development/python-modules/pymaging { }; pymaging = callPackage ../development/python-modules/pymaging { };