2021-12-06 13:49:23 +01:00
|
|
|
{ lib
|
|
|
|
, python3Packages
|
|
|
|
, enableOCR ? false
|
|
|
|
, qemu_pkg ? qemu_test
|
|
|
|
, coreutils
|
|
|
|
, imagemagick_light
|
|
|
|
, netpbm
|
|
|
|
, qemu_test
|
|
|
|
, socat
|
2023-09-30 09:56:42 +02:00
|
|
|
, ruff
|
2021-12-06 13:49:23 +01:00
|
|
|
, tesseract4
|
|
|
|
, vde2
|
2022-05-23 11:08:13 +02:00
|
|
|
, extraPythonPackages ? (_ : [])
|
2023-10-27 13:34:03 +02:00
|
|
|
, nixosTests
|
2021-12-06 13:49:23 +01:00
|
|
|
}:
|
2024-06-14 20:42:16 +02:00
|
|
|
let
|
|
|
|
fs = lib.fileset;
|
|
|
|
in
|
2023-09-30 09:56:42 +02:00
|
|
|
python3Packages.buildPythonApplication {
|
2021-12-06 13:49:23 +01:00
|
|
|
pname = "nixos-test-driver";
|
2022-01-01 23:06:07 +01:00
|
|
|
version = "1.1";
|
2024-06-14 20:42:16 +02:00
|
|
|
src = fs.toSource {
|
|
|
|
root = ./.;
|
|
|
|
fileset = fs.unions [
|
|
|
|
./pyproject.toml
|
|
|
|
./test_driver
|
|
|
|
./extract-docstrings.py
|
|
|
|
];
|
|
|
|
};
|
2024-01-12 11:58:07 +01:00
|
|
|
pyproject = true;
|
2021-12-06 13:49:23 +01:00
|
|
|
|
2022-05-23 11:08:13 +02:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
coreutils
|
|
|
|
netpbm
|
|
|
|
python3Packages.colorama
|
2024-04-02 14:30:52 +02:00
|
|
|
python3Packages.junit-xml
|
2022-05-23 11:08:13 +02:00
|
|
|
python3Packages.ptpython
|
|
|
|
qemu_pkg
|
|
|
|
socat
|
|
|
|
vde2
|
|
|
|
]
|
|
|
|
++ (lib.optionals enableOCR [ imagemagick_light tesseract4 ])
|
|
|
|
++ extraPythonPackages python3Packages;
|
2021-12-06 13:49:23 +01:00
|
|
|
|
2024-01-12 11:58:07 +01:00
|
|
|
nativeBuildInputs = [
|
|
|
|
python3Packages.setuptools
|
|
|
|
];
|
|
|
|
|
2023-10-27 13:34:03 +02:00
|
|
|
passthru.tests = {
|
|
|
|
inherit (nixosTests.nixos-test-driver) driver-timeout;
|
|
|
|
};
|
|
|
|
|
2021-12-06 13:49:23 +01:00
|
|
|
doCheck = true;
|
2023-09-30 09:56:42 +02:00
|
|
|
nativeCheckInputs = with python3Packages; [ mypy ruff black ];
|
2021-12-06 13:49:23 +01:00
|
|
|
checkPhase = ''
|
2023-09-30 09:56:42 +02:00
|
|
|
echo -e "\x1b[32m## run mypy\x1b[0m"
|
|
|
|
mypy test_driver extract-docstrings.py
|
|
|
|
echo -e "\x1b[32m## run ruff\x1b[0m"
|
2024-05-22 11:25:53 +02:00
|
|
|
ruff check .
|
2023-09-30 09:56:42 +02:00
|
|
|
echo -e "\x1b[32m## run black\x1b[0m"
|
|
|
|
black --check --diff .
|
2021-12-06 13:49:23 +01:00
|
|
|
'';
|
|
|
|
}
|