about summary refs log tree commit diff
path: root/pkgs/development/python-modules/craft-application-1/default.nix
blob: e47e502e09f257dd2d09b813135bd7e50a4e2b81 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  nix-update-script,
  craft-cli,
  craft-parts,
  craft-providers,
  pydantic-yaml-0,
  pyyaml,
  setuptools,
  setuptools-scm,
  pytestCheckHook,
  pytest-check,
  pytest-mock,
  hypothesis,
}:

buildPythonPackage rec {
  pname = "craft-application-1";
  version = "1.2.1";

  pyproject = true;

  src = fetchFromGitHub {
    owner = "canonical";
    repo = "craft-application";
    rev = "refs/tags/${version}";
    hash = "sha256-CXZEWVoE66dlQJp4G8tinufjyaDJaH1Muxz/qd/81oA=";
  };

  postPatch = ''
    substituteInPlace craft_application/__init__.py \
      --replace-fail "dev" "${version}"

    substituteInPlace pyproject.toml \
      --replace-fail "setuptools==67.7.2" "setuptools"
  '';

  nativeBuildInputs = [
    setuptools
    setuptools-scm
  ];

  propagatedBuildInputs = [
    craft-cli
    craft-parts
    craft-providers
    pydantic-yaml-0
    pyyaml
  ];

  pythonImportsCheck = [ "craft_application" ];

  nativeCheckInputs = [
    hypothesis
    pytest-check
    pytest-mock
    pytestCheckHook
  ];

  preCheck = ''
    export HOME=$(mktemp -d)
  '';

  pytestFlagsArray = [ "tests/unit" ];

  disabledTests = [ "test_to_yaml_file" ];

  passthru.updateScript = nix-update-script { };

  meta = {
    description = "Basis for Canonical craft applications";
    homepage = "https://github.com/canonical/craft-application";
    changelog = "https://github.com/canonical/craft-application/releases/tag/${version}";
    license = lib.licenses.lgpl3Only;
    maintainers = with lib.maintainers; [ jnsgruk ];
    platforms = lib.platforms.linux;
  };
}