Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at r-updates 107 lines 2.8 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 nix-update-script, 6 packaging, 7 platformdirs, 8 pydantic, 9 pyyaml, 10 requests-unixsocket, 11 setuptools-scm, 12 pytest-check, 13 pytest-mock, 14 pytestCheckHook, 15 responses, 16 freezegun, 17 pytest-subprocess, 18 logassert, 19 writableTmpDirAsHomeHook, 20}: 21 22buildPythonPackage rec { 23 pname = "craft-providers"; 24 version = "2.4.0"; 25 26 pyproject = true; 27 28 src = fetchFromGitHub { 29 owner = "canonical"; 30 repo = "craft-providers"; 31 tag = version; 32 hash = "sha256-frcRv+19czsZ948SEKfYsMUP6n9MbJv6gxXUAdwFw4Y="; 33 }; 34 35 patches = [ 36 # This lib will try to inject snaps *from the host system* into the build 37 # system. This patch short-circuits that logic and ensures that snaps are 38 # installed on the build system from the snap store - because there is no 39 # snapd on NixOS hosts that can be used for the injection. This patch will 40 # likely never be accepted upstream. 41 ./inject-snaps.patch 42 ]; 43 44 postPatch = '' 45 substituteInPlace craft_providers/lxd/installer.py \ 46 --replace-fail "/var/snap/lxd/common/lxd/unix.socket" "/var/lib/lxd/unix.socket" 47 48 substituteInPlace craft_providers/__init__.py \ 49 --replace-fail "dev" "${version}" 50 51 # The urllib3 incompat: https://github.com/msabramo/requests-unixsocket/pull/69 52 # This is already patched in nixpkgs. 53 substituteInPlace pyproject.toml \ 54 --replace-fail "setuptools==75.9.1" "setuptools" 55 ''; 56 57 pythonRelaxDeps = [ "requests" ]; 58 59 build-system = [ setuptools-scm ]; 60 61 dependencies = [ 62 packaging 63 platformdirs 64 pydantic 65 pyyaml 66 requests-unixsocket 67 ]; 68 69 pythonImportsCheck = [ "craft_providers" ]; 70 71 nativeCheckInputs = [ 72 freezegun 73 logassert 74 pytest-check 75 pytest-mock 76 pytest-subprocess 77 pytestCheckHook 78 responses 79 writableTmpDirAsHomeHook 80 ]; 81 82 enabledTestPaths = [ "tests/unit" ]; 83 84 disabledTestPaths = [ 85 # Relies upon "logassert" python package which isn't in nixpkgs 86 "tests/unit/bases/test_ubuntu_buildd.py" 87 "tests/unit/bases/test_centos_7.py" 88 "tests/unit/bases/test_almalinux.py" 89 "tests/unit/actions/test_snap_installer.py" 90 # Relies upon "pytest-time" python package which isn't in nixpkgs 91 "tests/unit/multipass" 92 "tests/unit/lxd" 93 "tests/unit/test_base.py" 94 "tests/unit/util/test_retry.py" 95 ]; 96 97 passthru.updateScript = nix-update-script { }; 98 99 meta = { 100 description = "Interfaces for instantiating and controlling a variety of build environments"; 101 homepage = "https://github.com/canonical/craft-providers"; 102 changelog = "https://github.com/canonical/craft-providers/releases/tag/${src.tag}"; 103 license = lib.licenses.lgpl3Only; 104 maintainers = with lib.maintainers; [ jnsgruk ]; 105 platforms = lib.platforms.linux; 106 }; 107}