anchor.diff: -{ stdenv, fetchFromGitHub, python3Packages, writeText, writeScript
  +{ stdenv, runtimeShell, fetchFromGitHub, python3, writeText, writeScript
   , coreutils, sqlite }:
   
  -with python3Packages;
  +with python3.pkgs;
   
   let
     dbSql = writeText "create_pykms_db.sql" ''
  
positive.code:   '';
  
    dbScript = writeScript "create_pykms_db.sh" (with stdenv.lib; ''
      #!${stdenv.shell} -eu
  
      db=$1
  
      ${getBin coreutils}/bin/install -d $(dirname $db)
  
      if [ ! -e $db ] ; then
        ${getBin sqlite}/bin/sqlite3 $db < ${dbSql}
      fi
    '');
  
  in buildPythonApplication {
    pname = "pykms";
    version = "20180208";
  
    src = fetchFromGitHub {
      owner  = "ThunderEX";
      repo   = "py-kms";
      rev    = "a1666a0ee5b404569a234afd05b164accc9a8845";
      sha256 = "17yj5n8byxp09l5zkap73hpphjy35px84wy68ps824w8l0l8kcd4";
    };
  
    propagatedBuildInputs = [ pytz ];
  
    prePatch = ''
      siteDir=$out/${python.sitePackages}
  
      substituteInPlace kmsBase.py \
        --replace "'KmsDataBase.xml'" "'$siteDir/KmsDataBase.xml'"
    '';
  
    dontBuild = true;
  
    # there are no tests
    doCheck = false;
  
negative.code:   installPhase = ''
      runHook preInstall
  
      mkdir -p $siteDir
  
      mv * $siteDir
      for b in Client Server ; do
        makeWrapper ${python.interpreter} $out/bin/''${b,,} \
          --argv0 ''${b,,} \
          --add-flags $siteDir/pykms_$b.py \
          --prefix PYTHONPATH : "$(toPythonPath ${systemd})"
      done
  
      install -Dm755 ${dbScript} $out/libexec/create_pykms_db.sh
  
      install -Dm644 ../README.md -t $out/share/doc/pykms
  
      ${python.interpreter} -m compileall $siteDir
  
  