1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 nix-update-script,
6 platformdirs,
7 pydantic_1,
8 pyyaml,
9 setuptools,
10 setuptools-scm,
11 pytest-check,
12 pytest-mock,
13 pytestCheckHook,
14}:
15
16buildPythonPackage rec {
17 pname = "craft-cli";
18 version = "2.5.1";
19
20 pyproject = true;
21
22 src = fetchFromGitHub {
23 owner = "canonical";
24 repo = "craft-cli";
25 rev = "refs/tags/${version}";
26 hash = "sha256-yEKF04OPu4paRrghAP78r9hu6cqkUy6z/V7cHNys82I=";
27 };
28
29 postPatch = ''
30 substituteInPlace craft_cli/__init__.py \
31 --replace-fail "dev" "${version}"
32
33 substituteInPlace pyproject.toml \
34 --replace-fail "setuptools==67.7.2" "setuptools"
35 '';
36
37 nativeBuildInputs = [
38 setuptools
39 setuptools-scm
40 ];
41
42 propagatedBuildInputs = [
43 platformdirs
44 pydantic_1
45 pyyaml
46 ];
47
48 pythonImportsCheck = [ "craft_cli" ];
49
50 nativeCheckInputs = [
51 pytest-check
52 pytest-mock
53 pytestCheckHook
54 ];
55
56 pytestFlagsArray = [ "tests/unit" ];
57
58 passthru.updateScript = nix-update-script { };
59
60 meta = {
61 description = "A CLI builder for Canonical's CLI Guidelines";
62 homepage = "https://github.com/canonical/craft-cli";
63 changelog = "https://github.com/canonical/craft-cli/releases/tag/${version}";
64 license = lib.licenses.lgpl3Only;
65 maintainers = with lib.maintainers; [ jnsgruk ];
66 platforms = lib.platforms.linux;
67 };
68}