Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at gcc-offload 124 lines 2.7 kB view raw
1{ 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, 29}: 30 31buildPythonPackage rec { 32 pname = "craft-application"; 33 version = "4.6.0"; 34 pyproject = true; 35 36 disabled = pythonOlder "3.10"; 37 38 src = fetchFromGitHub { 39 owner = "canonical"; 40 repo = "craft-application"; 41 rev = "refs/tags/${version}"; 42 hash = "sha256-kDujv7iVUvPfP9g3Ofm0Vso+I6qKBOq9NlFpigd6+Tc="; 43 }; 44 45 postPatch = '' 46 substituteInPlace pyproject.toml \ 47 --replace-fail "setuptools==75.2.0" "setuptools" 48 ''; 49 50 build-system = [ setuptools-scm ]; 51 52 pythonRelaxDeps = [ 53 "pygit2" 54 "requests" 55 ]; 56 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 ]; 70 71 nativeCheckInputs = [ 72 freezegun 73 git 74 hypothesis 75 pyfakefs 76 pytest-check 77 pytest-mock 78 pytest-subprocess 79 pytestCheckHook 80 responses 81 ]; 82 83 preCheck = '' 84 export HOME=$(mktemp -d) 85 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 92 93 substituteInPlace craft_application/util/platforms.py \ 94 --replace-fail "os_utils.OsRelease()" "os_utils.OsRelease(os_release_file='$HOME/os-release')" 95 ''; 96 97 pythonImportsCheck = [ "craft_application" ]; 98 99 pytestFlagsArray = [ "tests/unit" ]; 100 101 disabledTests = 102 [ 103 "test_to_yaml_file" 104 # Tests expecting pytest-time 105 "test_monitor_builds_success" 106 ] 107 ++ lib.optionals stdenv.hostPlatform.isAarch64 [ 108 # These tests have hardcoded "amd64" strings which fail on aarch64 109 "test_process_grammar_build_for" 110 "test_process_grammar_platform" 111 "test_process_grammar_default" 112 ]; 113 114 passthru.updateScript = nix-update-script { }; 115 116 meta = { 117 description = "Basis for Canonical craft applications"; 118 homepage = "https://github.com/canonical/craft-application"; 119 changelog = "https://github.com/canonical/craft-application/blob/${src.rev}/docs/reference/changelog.rst"; 120 license = lib.licenses.lgpl3Only; 121 maintainers = with lib.maintainers; [ jnsgruk ]; 122 platforms = lib.platforms.linux; 123 }; 124}