generate_test_vars: move into clan_cli
Reduces overhead by not having to manage a separate package for this small tool
This commit is contained in:
@@ -108,13 +108,6 @@
|
||||
extraPythonPackages = (self'.packages.clan-app.devshellPyDeps pkgs.python3Packages);
|
||||
extraPythonPaths = [ "../../clan-cli" ];
|
||||
};
|
||||
"generate-test-vars" = {
|
||||
directory = "pkgs/generate-test-vars";
|
||||
extraPythonPackages = [
|
||||
(pkgs.python3.withPackages (ps: self'.packages.clan-cli.devshellPyDeps ps))
|
||||
];
|
||||
extraPythonPaths = [ "../clan-cli" ];
|
||||
};
|
||||
}
|
||||
// (
|
||||
if pkgs.stdenv.isLinux then
|
||||
|
||||
@@ -77,9 +77,7 @@ in
|
||||
) machineModules
|
||||
);
|
||||
|
||||
update-vars-script = "${
|
||||
self.packages.${hostPkgs.system}.generate-test-vars
|
||||
}/bin/generate-test-vars";
|
||||
update-vars-script = "${self.packages.${hostPkgs.system}.clan-cli}/bin/clan-generate-test-vars";
|
||||
|
||||
relativeDir = removePrefix "${self}/" (toString config.clan.directory);
|
||||
|
||||
|
||||
12
pkgs/clan-cli/bin/clan-generate-test-vars
Executable file
12
pkgs/clan-cli/bin/clan-generate-test-vars
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.insert(
|
||||
0, os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
|
||||
)
|
||||
|
||||
from clan_cli.generate_test_vars.cli import main # NOQA
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -6,16 +6,19 @@ build-backend = "setuptools.build_meta"
|
||||
name = "clan"
|
||||
description = "clan cli tool"
|
||||
dynamic = ["version"]
|
||||
scripts = { clan = "clan_cli.cli:main" }
|
||||
license = { text = "MIT" }
|
||||
|
||||
[project.scripts]
|
||||
clan = "clan_cli.cli:main"
|
||||
clan-generate-test-vars = "clan_cli.generate_test_vars.cli:main"
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://clan.lol/"
|
||||
Documentation = "https://docs.clan.lol/"
|
||||
Repository = "https://git.clan.lol/clan/clan-core"
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
include = ["clan_lib*", "clan_cli*"]
|
||||
include = ["clan_lib*", "clan_cli*", "generate_test_vars*"]
|
||||
exclude = ["clan_lib.nixpkgs*", "result"]
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
./clan-vm-manager/flake-module.nix
|
||||
./installer/flake-module.nix
|
||||
./icon-update/flake-module.nix
|
||||
./generate-test-vars/flake-module.nix
|
||||
./clan-core-flake/flake-module.nix
|
||||
./clan-app/flake-module.nix
|
||||
./testing/flake-module.nix
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
buildPythonApplication,
|
||||
python,
|
||||
clan-cli,
|
||||
}:
|
||||
buildPythonApplication {
|
||||
name = "generate-test-vars";
|
||||
src = ./.;
|
||||
format = "pyproject";
|
||||
dependencies = [ (python.pkgs.toPythonModule clan-cli) ];
|
||||
nativeBuildInputs = [
|
||||
(python.withPackages (ps: [ ps.setuptools ]))
|
||||
];
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
$out/bin/generate-test-vars --help
|
||||
runHook preCheck
|
||||
'';
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
{ ... }:
|
||||
{
|
||||
perSystem =
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
self',
|
||||
...
|
||||
}:
|
||||
{
|
||||
devShells.vars-generator = pkgs.callPackage ./shell.nix {
|
||||
inherit (self'.packages) generate-test-vars;
|
||||
};
|
||||
|
||||
packages.generate-test-vars = pkgs.python3.pkgs.callPackage ./default.nix {
|
||||
inherit (config.packages) clan-cli;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
[build-system]
|
||||
requires = ["setuptools"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
|
||||
[project]
|
||||
name = "generate-test-vars"
|
||||
description = "vars generate"
|
||||
dynamic = ["version"]
|
||||
scripts = { generate-test-vars = "generate_test_vars.cli:main" }
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://clan.lol/"
|
||||
Documentation = "https://docs.clan.lol/"
|
||||
Repository = "https://git.clan.lol/clan/clan-core"
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
exclude = ["result", "**/__pycache__"]
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
testpaths = "tests"
|
||||
faulthandler_timeout = 60
|
||||
log_level = "DEBUG"
|
||||
log_format = "%(levelname)s: %(message)s\n %(pathname)s:%(lineno)d::%(funcName)s"
|
||||
addopts = "--durations 5 --color=yes --new-first" # Add --pdb for debugging
|
||||
norecursedirs = "tests/helpers"
|
||||
|
||||
[tool.mypy]
|
||||
python_version = "3.13"
|
||||
warn_redundant_casts = true
|
||||
disallow_untyped_calls = true
|
||||
disallow_untyped_defs = true
|
||||
no_implicit_optional = true
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
{ pkgs, generate-test-vars }:
|
||||
pkgs.mkShell {
|
||||
inputsFrom = [
|
||||
generate-test-vars
|
||||
];
|
||||
# packages = with pkgs; [ python3 ];
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
# Test that we can generate vars
|
||||
{
|
||||
vars.generators = {
|
||||
test_generator_1 = {
|
||||
files.hello = {
|
||||
secret = false;
|
||||
};
|
||||
script = ''
|
||||
echo "hello world 1" > $out/hello
|
||||
'';
|
||||
};
|
||||
test_generator_2 = {
|
||||
files.hello = {
|
||||
secret = false;
|
||||
};
|
||||
script = ''
|
||||
echo "hello world 2" > $out/hello
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user