1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 nix-update-script,
6 craft-cli,
7 craft-parts,
8 craft-providers,
9 pydantic-yaml-0,
10 pyyaml,
11 setuptools,
12 setuptools-scm,
13 pytestCheckHook,
14 pytest-check,
15 pytest-mock,
16 hypothesis,
17}:
18
19buildPythonPackage rec {
20 pname = "craft-application-1";
21 version = "1.2.1";
22
23 pyproject = true;
24
25 src = fetchFromGitHub {
26 owner = "canonical";
27 repo = "craft-application";
28 rev = "refs/tags/${version}";
29 hash = "sha256-CXZEWVoE66dlQJp4G8tinufjyaDJaH1Muxz/qd/81oA=";
30 };
31
32 postPatch = ''
33 substituteInPlace craft_application/__init__.py \
34 --replace-fail "dev" "${version}"
35
36 substituteInPlace pyproject.toml \
37 --replace-fail "setuptools==67.7.2" "setuptools"
38 '';
39
40 nativeBuildInputs = [
41 setuptools
42 setuptools-scm
43 ];
44
45 propagatedBuildInputs = [
46 craft-cli
47 craft-parts
48 craft-providers
49 pydantic-yaml-0
50 pyyaml
51 ];
52
53 pythonImportsCheck = [ "craft_application" ];
54
55 nativeCheckInputs = [
56 hypothesis
57 pytest-check
58 pytest-mock
59 pytestCheckHook
60 ];
61
62 preCheck = ''
63 export HOME=$(mktemp -d)
64 '';
65
66 pytestFlagsArray = [ "tests/unit" ];
67
68 disabledTests = [ "test_to_yaml_file" ];
69
70 passthru.updateScript = nix-update-script { };
71
72 meta = {
73 description = "The basis for Canonical craft applications";
74 homepage = "https://github.com/canonical/craft-application";
75 changelog = "https://github.com/canonical/craft-application/releases/tag/${version}";
76 license = lib.licenses.lgpl3Only;
77 maintainers = with lib.maintainers; [ jnsgruk ];
78 platforms = lib.platforms.linux;
79 };
80}