diff options
author | Peter Hoeg <peter@hoeg.com> | 2021-01-31 20:40:19 +0800 |
---|---|---|
committer | Peter Hoeg <peter@hoeg.com> | 2021-02-03 15:59:17 +0800 |
commit | a3773da14260b53fbb32aebe92957b36b810091b (patch) | |
tree | 0b1492bc134375adf41bc9cdb95d763ecc50b020 /pkgs/tools/networking/pykms | |
parent | bed33d185a246b62de5a5105f86ecc10032ea59a (diff) |
pykms: 2019-06-11 -> 2021-01-25
Diffstat (limited to 'pkgs/tools/networking/pykms')
-rw-r--r-- | pkgs/tools/networking/pykms/default.nix | 55 | ||||
-rw-r--r-- | pkgs/tools/networking/pykms/log-to-current-directory-by-default.patch | 20 |
2 files changed, 27 insertions, 48 deletions
diff --git a/pkgs/tools/networking/pykms/default.nix b/pkgs/tools/networking/pykms/default.nix index 0d001e7aeef19..d648ff3ec1ed1 100644 --- a/pkgs/tools/networking/pykms/default.nix +++ b/pkgs/tools/networking/pykms/default.nix @@ -1,9 +1,13 @@ -{ lib, runtimeShell, fetchFromGitHub, python3, writeText, writeScript -, coreutils, sqlite }: - -with python3.pkgs; - +{ lib +, fetchFromGitHub +, python3 +, writeText +, writeShellScript +, sqlite +}: let + pypkgs = python3.pkgs; + dbSql = writeText "create_pykms_db.sql" '' CREATE TABLE clients( clientMachineId TEXT, @@ -17,35 +21,31 @@ let ); ''; - dbScript = writeScript "create_pykms_db.sh" (with lib; '' - #!${runtimeShell} - + dbScript = writeShellScript "create_pykms_db.sh" '' set -eEuo pipefail - db=$1 + db=''${1:-/var/lib/pykms/clients.db} if [ ! -e $db ] ; then - ${getBin sqlite}/bin/sqlite3 $db < ${dbSql} + ${lib.getBin sqlite}/bin/sqlite3 $db < ${dbSql} fi - ''); + ''; -in buildPythonApplication rec { +in +pypkgs.buildPythonApplication rec { pname = "pykms"; - version = "20190611"; + version = "unstable-2021-01-25"; src = fetchFromGitHub { - owner = "SystemRage"; - repo = "py-kms"; - rev = "dead208b1593655377fe8bc0d74cc4bead617103"; - sha256 = "065qpkfqrahsam1rb43vnasmzrangan5z1pr3p6s0sqjz5l2jydp"; + owner = "SystemRage"; + repo = "py-kms"; + rev = "a3b0c85b5b90f63b33dfa5ae6085fcd52c6da2ff"; + sha256 = "sha256-u0R0uJMQxHnJUDenxglhQkZza3/1DcyXCILcZVceygA="; }; sourceRoot = "source/py-kms"; - propagatedBuildInputs = [ systemd pytz tzlocal ]; - - # Fix https://github.com/SystemRage/py-kms/issues/64 : - patches = [ ./log-to-current-directory-by-default.patch ]; + propagatedBuildInputs = with pypkgs; [ systemd pytz tzlocal ]; postPatch = '' siteDir=$out/${python3.sitePackages} @@ -66,25 +66,24 @@ in buildPythonApplication rec { 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})" + makeWrapper ${python3.interpreter} $out/bin/''${b,,} \ + --argv0 pykms-''${b,,} \ + --add-flags $siteDir/pykms_$b.py done install -Dm755 ${dbScript} $out/libexec/create_pykms_db.sh install -Dm644 ../README.md -t $out/share/doc/pykms - ${python.interpreter} -m compileall $siteDir + ${python3.interpreter} -m compileall $siteDir runHook postInstall ''; meta = with lib; { description = "Windows KMS (Key Management Service) server written in Python"; - homepage = "https://github.com/SystemRage/py-kms"; - license = licenses.mit; + homepage = "https://github.com/SystemRage/py-kms"; + license = licenses.unlicense; maintainers = with maintainers; [ peterhoeg ]; }; } diff --git a/pkgs/tools/networking/pykms/log-to-current-directory-by-default.patch b/pkgs/tools/networking/pykms/log-to-current-directory-by-default.patch deleted file mode 100644 index 7c8c65b63a2a0..0000000000000 --- a/pkgs/tools/networking/pykms/log-to-current-directory-by-default.patch +++ /dev/null @@ -1,20 +0,0 @@ -# By default, create log files in current directory, instead of the script directory. ---- ../original/py-kms/pykms_Client.py -+++ py-kms/pykms_Client.py -@@ -48,5 +48,5 @@ - 'choi' : ["CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG", "MINI"]}, - 'lfile' : {'help' : 'Use this option to set an output log file. The default is \"pykms_logclient.log\" or type \"STDOUT\" to view log info on stdout.', -- 'def' : os.path.dirname(os.path.abspath( __file__ )) + "/pykms_logclient.log", 'des' : "logfile"}, -+ 'def' : "pykms_logclient.log", 'des' : "logfile"}, - 'lsize' : {'help' : 'Use this flag to set a maximum size (in MB) to the output log file. Desactivated by default.', 'def' : 0, 'des': "logsize"}, - } ---- ../original/py-kms/pykms_Server.py -+++ py-kms/pykms_Server.py -@@ -85,5 +85,5 @@ - 'choi' : ["CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG", "MINI"]}, - 'lfile' : {'help' : 'Use this option to set or not an output log file. The default is \"pykms_logserver.log\" or type \"STDOUT\" to view log info on stdout.', -- 'def' : os.path.dirname(os.path.abspath( __file__ )) + "/pykms_logserver.log", 'des' : "logfile"}, -+ 'def' : "pykms_logserver.log", 'des' : "logfile"}, - 'lsize' : {'help' : 'Use this flag to set a maximum size (in MB) to the output log file. Desactivated by default.', 'def' : 0, 'des': "logsize"}, - } - ''); |