evcc: 0.131.4 -> 0.131.5
[NixPkgs.git] / pkgs / development / python-modules / craft-application / default.nix
blobd51a12f46cb9181b97c1a9f6de6a910f4bf4f420
2   lib,
3   stdenv,
4   buildPythonPackage,
5   craft-archives,
6   craft-cli,
7   craft-grammar,
8   craft-parts,
9   craft-providers,
10   fetchFromGitHub,
11   git,
12   hypothesis,
13   license-expression,
14   nix-update-script,
15   pyfakefs,
16   pygit2,
17   pytest-check,
18   pytest-mock,
19   pytest-subprocess,
20   pytestCheckHook,
21   pythonOlder,
22   pyyaml,
23   responses,
24   setuptools-scm,
25   snap-helpers,
28 buildPythonPackage rec {
29   pname = "craft-application";
30   version = "4.2.5";
31   pyproject = true;
33   disabled = pythonOlder "3.10";
35   src = fetchFromGitHub {
36     owner = "canonical";
37     repo = "craft-application";
38     rev = "refs/tags/${version}";
39     hash = "sha256-Y/Eci0ByE1HxUcxWhpQq0F2Ef1xkXZMBDGmUSIyPKII=";
40   };
42   postPatch = ''
43     substituteInPlace pyproject.toml \
44       --replace-fail "setuptools==74.1.1" "setuptools"
45   '';
47   build-system = [ setuptools-scm ];
49   pythonRelaxDeps = [
50     "pygit2"
51     "requests"
52   ];
54   dependencies = [
55     craft-archives
56     craft-cli
57     craft-grammar
58     craft-parts
59     craft-providers
60     license-expression
61     pygit2
62     pyyaml
63     snap-helpers
64   ];
66   nativeCheckInputs = [
67     git
68     hypothesis
69     pyfakefs
70     pytest-check
71     pytest-mock
72     pytest-subprocess
73     pytestCheckHook
74     responses
75   ];
77   preCheck = ''
78     export HOME=$(mktemp -d)
80     # Tests require access to /etc/os-release, which isn't accessible in
81     # the test environment, so create a fake file, and modify the code
82     # to look for it.
83     echo 'ID=nixos' > $HOME/os-release
84     echo 'NAME=NixOS' >> $HOME/os-release
85     echo 'VERSION_ID="24.05"' >> $HOME/os-release
87     substituteInPlace craft_application/util/platforms.py \
88       --replace-fail "os_utils.OsRelease()" "os_utils.OsRelease(os_release_file='$HOME/os-release')"
89   '';
91   pythonImportsCheck = [ "craft_application" ];
93   pytestFlagsArray = [ "tests/unit" ];
95   disabledTests =
96     [
97       "test_to_yaml_file"
98       # Tests expecting pytest-time
99       "test_monitor_builds_success"
100     ]
101     ++ lib.optionals stdenv.hostPlatform.isAarch64 [
102       # These tests have hardcoded "amd64" strings which fail on aarch64
103       "test_process_grammar_build_for"
104       "test_process_grammar_platform"
105       "test_process_grammar_default"
106     ];
108   passthru.updateScript = nix-update-script { };
110   meta = {
111     description = "Basis for Canonical craft applications";
112     homepage = "https://github.com/canonical/craft-application";
113     changelog = "https://github.com/canonical/craft-application/blob/${src.rev}/docs/reference/changelog.rst";
114     license = lib.licenses.lgpl3Only;
115     maintainers = with lib.maintainers; [ jnsgruk ];
116     platforms = lib.platforms.linux;
117   };