saunafs: 4.6.0 -> 4.7.0 (#379649)
[NixPkgs.git] / pkgs / development / python-modules / craft-application / default.nix
blob762f45403da3830502548e7e8f5663554dd57a83
2   lib,
3   stdenv,
4   buildPythonPackage,
5   craft-archives,
6   craft-cli,
7   craft-grammar,
8   craft-parts,
9   craft-platforms,
10   craft-providers,
11   jinja2,
12   fetchFromGitHub,
13   git,
14   hypothesis,
15   license-expression,
16   nix-update-script,
17   pyfakefs,
18   pygit2,
19   pytest-check,
20   pytest-mock,
21   pytest-subprocess,
22   pytestCheckHook,
23   pythonOlder,
24   pyyaml,
25   responses,
26   setuptools-scm,
27   snap-helpers,
28   freezegun,
31 buildPythonPackage rec {
32   pname = "craft-application";
33   version = "4.8.2";
34   pyproject = true;
36   disabled = pythonOlder "3.10";
38   src = fetchFromGitHub {
39     owner = "canonical";
40     repo = "craft-application";
41     tag = version;
42     hash = "sha256-rKeEi9z5eQfjn0Q4FR6CVIz9YDS7Ejg4cqcor5wtz0s=";
43   };
45   postPatch = ''
46     substituteInPlace pyproject.toml \
47       --replace-fail "setuptools==75.2.0" "setuptools"
48   '';
50   build-system = [ setuptools-scm ];
52   pythonRelaxDeps = [
53     "pygit2"
54     "requests"
55   ];
57   dependencies = [
58     craft-archives
59     craft-cli
60     craft-grammar
61     craft-parts
62     craft-platforms
63     craft-providers
64     jinja2
65     license-expression
66     pygit2
67     pyyaml
68     snap-helpers
69   ];
71   nativeCheckInputs = [
72     freezegun
73     git
74     hypothesis
75     pyfakefs
76     pytest-check
77     pytest-mock
78     pytest-subprocess
79     pytestCheckHook
80     responses
81   ];
83   preCheck = ''
84     export HOME=$(mktemp -d)
86     # Tests require access to /etc/os-release, which isn't accessible in
87     # the test environment, so create a fake file, and modify the code
88     # to look for it.
89     echo 'ID=nixos' > $HOME/os-release
90     echo 'NAME=NixOS' >> $HOME/os-release
91     echo 'VERSION_ID="24.05"' >> $HOME/os-release
93     substituteInPlace craft_application/util/platforms.py \
94       --replace-fail "os_utils.OsRelease()" "os_utils.OsRelease(os_release_file='$HOME/os-release')"
95   '';
97   pythonImportsCheck = [ "craft_application" ];
99   pytestFlagsArray = [ "tests/unit" ];
101   disabledTests =
102     [
103       "test_to_yaml_file"
104       # Tests expecting pytest-time
105       "test_monitor_builds_success"
106       # Temporary fix until new release to support Python 3.13
107       "test_grammar_aware_part_error"
108       "test_grammar_aware_part_error[part2]"
109       "test_grammar_aware_project_error[project0]"
110     ]
111     ++ lib.optionals stdenv.hostPlatform.isAarch64 [
112       # These tests have hardcoded "amd64" strings which fail on aarch64
113       "test_process_grammar_build_for"
114       "test_process_grammar_platform"
115       "test_process_grammar_default"
116     ];
118   passthru.updateScript = nix-update-script { };
120   meta = {
121     description = "Basis for Canonical craft applications";
122     homepage = "https://github.com/canonical/craft-application";
123     changelog = "https://github.com/canonical/craft-application/blob/${src.tag}/docs/reference/changelog.rst";
124     license = lib.licenses.lgpl3Only;
125     maintainers = with lib.maintainers; [ jnsgruk ];
126     platforms = lib.platforms.linux;
127   };