pykms: switch to maintained fork, fix PYTHONPATH, add test

I have read the full diff[0] between the previous owner and the new
maintained fork that I'm switching to, and could not find any suspicious
code. The new fork includes fixes that are otherwise crashing as of
Python 3.10.

This commit also fixes the PYTHONPATH which prevents the client from
starting.

This commit also adds a test that the client can successfully query the
server, testing the two components at once.

[0] https://github.com/SystemRage/py-kms/compare/master...Py-KMS-Organization:master
This commit is contained in:
Alexandre Macabies 2022-06-27 00:20:04 +02:00 committed by Peter Hoeg
parent 37f4b6bc1c
commit 32964dd23d
3 changed files with 25 additions and 7 deletions

View file

@ -458,6 +458,7 @@ in {
proxy = handleTest ./proxy.nix {};
prowlarr = handleTest ./prowlarr.nix {};
pt2-clone = handleTest ./pt2-clone.nix {};
pykms = handleTest ./pykms.nix {};
public-inbox = handleTest ./public-inbox.nix {};
pulseaudio = discoverTests (import ./pulseaudio.nix);
qboot = handleTestOn ["x86_64-linux" "i686-linux"] ./qboot.nix {};

14
nixos/tests/pykms.nix Normal file
View file

@ -0,0 +1,14 @@
import ./make-test-python.nix ({ pkgs, ... }:
{
name = "pykms-test";
meta.maintainers = with pkgs.lib.maintainers; [ zopieux ];
nodes.machine = { config, lib, pkgs, ... }: {
services.pykms.enable = true;
};
testScript = ''
machine.wait_for_unit("pykms.service")
machine.succeed("${pkgs.pykms}/bin/client")
'';
})

View file

@ -37,15 +37,15 @@ pypkgs.buildPythonApplication rec {
version = "unstable-2021-01-25";
src = fetchFromGitHub {
owner = "SystemRage";
owner = "Py-KMS-Organization";
repo = "py-kms";
rev = "a3b0c85b5b90f63b33dfa5ae6085fcd52c6da2ff";
sha256 = "sha256-u0R0uJMQxHnJUDenxglhQkZza3/1DcyXCILcZVceygA=";
rev = "1435c86fe4f11aa7fd42d77fa61715ca3015eeab";
hash = "sha256-9KiMbS0uKTbWSZVIv5ziIeR9c8+EKfKd20yPmjCX7GQ=";
};
sourceRoot = "source/py-kms";
propagatedBuildInputs = with pypkgs; [ systemd pytz tzlocal ];
propagatedBuildInputs = with pypkgs; [ systemd pytz tzlocal dnspython ];
postPatch = ''
siteDir=$out/${python3.sitePackages}
@ -64,11 +64,14 @@ pypkgs.buildPythonApplication rec {
mkdir -p $siteDir
PYTHONPATH="$PYTHONPATH:$siteDir"
mv * $siteDir
for b in Client Server ; do
makeWrapper ${python3.interpreter} $out/bin/''${b,,} \
--argv0 pykms-''${b,,} \
--add-flags $siteDir/pykms_$b.py
--add-flags $siteDir/pykms_$b.py \
--set PYTHONPATH $PYTHONPATH
done
install -Dm755 ${dbScript} $out/libexec/create_pykms_db.sh
@ -82,8 +85,8 @@ pypkgs.buildPythonApplication rec {
meta = with lib; {
description = "Windows KMS (Key Management Service) server written in Python";
homepage = "https://github.com/SystemRage/py-kms";
homepage = "https://github.com/Py-KMS-Organization/py-kms";
license = licenses.unlicense;
maintainers = with maintainers; [ peterhoeg ];
maintainers = with maintainers; [ peterhoeg zopieux ];
};
}