28 buildPythonPackage rec {
29 pname = "craft-application";
33 disabled = pythonOlder "3.10";
35 src = fetchFromGitHub {
37 repo = "craft-application";
38 rev = "refs/tags/${version}";
39 hash = "sha256-Y/Eci0ByE1HxUcxWhpQq0F2Ef1xkXZMBDGmUSIyPKII=";
43 substituteInPlace pyproject.toml \
44 --replace-fail "setuptools==74.1.1" "setuptools"
47 build-system = [ setuptools-scm ];
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
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')"
91 pythonImportsCheck = [ "craft_application" ];
93 pytestFlagsArray = [ "tests/unit" ];
98 # Tests expecting pytest-time
99 "test_monitor_builds_success"
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"
108 passthru.updateScript = nix-update-script { };
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;