2024-04-21 15:54:59 +00:00
|
|
|
{
|
|
|
|
lib,
|
2024-05-15 15:35:15 +00:00
|
|
|
stdenv,
|
2024-04-21 15:54:59 +00:00
|
|
|
buildPythonPackage,
|
|
|
|
craft-archives,
|
|
|
|
craft-cli,
|
|
|
|
craft-grammar,
|
|
|
|
craft-parts,
|
|
|
|
craft-providers,
|
2024-05-15 15:35:15 +00:00
|
|
|
fetchFromGitHub,
|
|
|
|
git,
|
|
|
|
hypothesis,
|
|
|
|
nix-update-script,
|
2024-07-27 06:49:29 +00:00
|
|
|
pydantic-yaml,
|
2024-04-21 15:54:59 +00:00
|
|
|
pyfakefs,
|
2024-05-15 15:35:15 +00:00
|
|
|
pygit2,
|
2024-04-21 15:54:59 +00:00
|
|
|
pytest-check,
|
|
|
|
pytest-mock,
|
2024-05-15 15:35:15 +00:00
|
|
|
pytestCheckHook,
|
|
|
|
pythonOlder,
|
|
|
|
pyyaml,
|
2024-04-21 15:54:59 +00:00
|
|
|
responses,
|
2024-05-15 15:35:15 +00:00
|
|
|
setuptools-scm,
|
|
|
|
snap-helpers,
|
2024-04-21 15:54:59 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "craft-application";
|
2024-07-27 06:49:29 +00:00
|
|
|
version = "3.2.0";
|
2024-04-21 15:54:59 +00:00
|
|
|
pyproject = true;
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
disabled = pythonOlder "3.10";
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "canonical";
|
|
|
|
repo = "craft-application";
|
|
|
|
rev = "refs/tags/${version}";
|
2024-07-27 06:49:29 +00:00
|
|
|
hash = "sha256-2JfCe7FJtuObC/4miA+OC/ctGy1fhdgI7DsowNYjQk8=";
|
2024-04-21 15:54:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace pyproject.toml \
|
2024-07-27 06:49:29 +00:00
|
|
|
--replace-fail "setuptools==70.1.0" "setuptools"
|
2024-04-21 15:54:59 +00:00
|
|
|
'';
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
build-system = [ setuptools-scm ];
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
pythonRelaxDeps = [
|
|
|
|
"pygit2"
|
|
|
|
"requests"
|
|
|
|
];
|
2024-04-21 15:54:59 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
dependencies = [
|
2024-04-21 15:54:59 +00:00
|
|
|
craft-archives
|
|
|
|
craft-cli
|
|
|
|
craft-grammar
|
|
|
|
craft-parts
|
|
|
|
craft-providers
|
2024-07-27 06:49:29 +00:00
|
|
|
pydantic-yaml
|
2024-04-21 15:54:59 +00:00
|
|
|
pygit2
|
|
|
|
pyyaml
|
|
|
|
snap-helpers
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeCheckInputs = [
|
|
|
|
git
|
|
|
|
hypothesis
|
|
|
|
pyfakefs
|
|
|
|
pytest-check
|
|
|
|
pytest-mock
|
|
|
|
pytestCheckHook
|
|
|
|
responses
|
|
|
|
];
|
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
|
|
|
|
# Tests require access to /etc/os-release, which isn't accessible in
|
|
|
|
# the test environment, so create a fake file, and modify the code
|
|
|
|
# to look for it.
|
|
|
|
echo 'ID=nixos' > $HOME/os-release
|
|
|
|
echo 'NAME=NixOS' >> $HOME/os-release
|
|
|
|
echo 'VERSION_ID="24.05"' >> $HOME/os-release
|
|
|
|
|
|
|
|
substituteInPlace craft_application/util/platforms.py \
|
|
|
|
--replace-fail "os_utils.OsRelease()" "os_utils.OsRelease(os_release_file='$HOME/os-release')"
|
|
|
|
'';
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
pythonImportsCheck = [ "craft_application" ];
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
pytestFlagsArray = [ "tests/unit" ];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
disabledTests =
|
|
|
|
[
|
|
|
|
"test_to_yaml_file"
|
|
|
|
# Tests expecting pytest-time
|
|
|
|
"test_monitor_builds_success"
|
|
|
|
]
|
2024-09-26 11:04:55 +00:00
|
|
|
++ lib.optionals stdenv.hostPlatform.isAarch64 [
|
2024-06-05 15:53:02 +00:00
|
|
|
# These tests have hardcoded "amd64" strings which fail on aarch64
|
|
|
|
"test_process_grammar_build_for"
|
|
|
|
"test_process_grammar_platform"
|
|
|
|
"test_process_grammar_default"
|
|
|
|
];
|
2024-04-21 15:54:59 +00:00
|
|
|
|
|
|
|
passthru.updateScript = nix-update-script { };
|
|
|
|
|
|
|
|
meta = {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Basis for Canonical craft applications";
|
2024-04-21 15:54:59 +00:00
|
|
|
homepage = "https://github.com/canonical/craft-application";
|
2024-07-27 06:49:29 +00:00
|
|
|
changelog = "https://github.com/canonical/craft-application/blob/${src.rev}/docs/reference/changelog.rst";
|
2024-04-21 15:54:59 +00:00
|
|
|
license = lib.licenses.lgpl3Only;
|
|
|
|
maintainers = with lib.maintainers; [ jnsgruk ];
|
|
|
|
platforms = lib.platforms.linux;
|
|
|
|
};
|
|
|
|
}
|