anchor.diff:  { lib
   , fetchFromGitHub
  -, xz
   , wrapQtAppsHook
   , miniupnpc_2
  +, ffmpeg
   , enableSwftools ? false
   , swftools
  -, pythonPackages
  +, python3Packages
   }:
   
  -pythonPackages.buildPythonPackage rec {
  +python3Packages.buildPythonPackage rec {
     pname = "hydrus";
     version = "447";
     format = "other";
  
positive.code: 
    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 = ''
      # Move the hydrus module and related directories
      mkdir -p $out/${pythonPackages.python.sitePackages}
      mv {hydrus,static} $out/${pythonPackages.python.sitePackages}
      mv help $out/doc/
  
      # install the hydrus binaries
      mkdir -p $out/bin
      install -m0755 server.py $out/bin/hydrus-server
      install -m0755 client.py $out/bin/hydrus-client
    '';
  
    dontWrapQtApps = true;
    preFixup = ''
      makeWrapperArgs+=("''${qtWrapperArgs[@]}")
    '';
  
    meta = with lib; {
  
negative.code:     wrapQtAppsHook
    ];
  
    propagatedBuildInputs = with python3Packages; [
      beautifulsoup4
      chardet
      cloudscraper
      html5lib
      lxml
      lz4
      nose
      numpy
      opencv4
      pillow
      psutil
      pylzma
      pyopenssl
      pyside2
      pysocks
      pythonPackages.mpv
      pyyaml
      qtpy
      requests
      send2trash
      service-identity
      six
      twisted
    ];
  
    checkInputs = with python3Packages; [ nose mock httmock ];
  
    # most tests are failing, presumably because we are not using test.py
    checkPhase = ''
  