biome: 1.9.2 -> 1.9.3 (#349335)
[NixPkgs.git] / pkgs / development / python-modules / craft-providers / default.nix
blob7dcf2fff8b52ca549644bbda0345c140d24c68b1
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   urllib3,
13   pytest-check,
14   pytest-mock,
15   pytestCheckHook,
16   responses,
17   freezegun,
18   pytest-subprocess,
19   pytest-logdog,
22 buildPythonPackage rec {
23   pname = "craft-providers";
24   version = "2.0.3";
26   pyproject = true;
28   src = fetchFromGitHub {
29     owner = "canonical";
30     repo = "craft-providers";
31     rev = "refs/tags/${version}";
32     hash = "sha256-DTUXT5vFIDI06oxka3diWJ5E5oqiX6GXB4ivq6+VrDk=";
33   };
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   ];
44   postPatch = ''
45     substituteInPlace craft_providers/lxd/installer.py \
46       --replace-fail "/var/snap/lxd/common/lxd/unix.socket" "/var/lib/lxd/unix.socket"
48     substituteInPlace craft_providers/__init__.py \
49       --replace-fail "dev" "${version}"
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==73.0.1" "setuptools" \
55       --replace-fail "urllib3<2" "urllib3"
56   '';
58   pythonRelaxDeps = [ "requests" ];
60   build-system = [ setuptools-scm ];
62   dependencies = [
63     packaging
64     platformdirs
65     pydantic
66     pyyaml
67     requests-unixsocket
68     urllib3
69   ];
71   pythonImportsCheck = [ "craft_providers" ];
73   nativeCheckInputs = [
74     freezegun
75     pytest-check
76     pytest-mock
77     pytest-subprocess
78     pytest-logdog
79     pytestCheckHook
80     responses
81   ];
83   preCheck = ''
84     mkdir -p check-phase
85     export HOME="$(pwd)/check-phase"
86   '';
88   pytestFlagsArray = [ "tests/unit" ];
90   disabledTestPaths = [
91     # Relies upon "logassert" python package which isn't in nixpkgs
92     "tests/unit/bases/test_ubuntu_buildd.py"
93     "tests/unit/bases/test_centos_7.py"
94     "tests/unit/bases/test_almalinux.py"
95     "tests/unit/actions/test_snap_installer.py"
96     # Relies upon "pytest-time" python package which isn't in nixpkgs
97     "tests/unit/multipass"
98     "tests/unit/lxd"
99     "tests/unit/test_base.py"
100     "tests/unit/util/test_retry.py"
101   ];
103   passthru.updateScript = nix-update-script { };
105   meta = {
106     description = "Interfaces for instantiating and controlling a variety of build environments";
107     homepage = "https://github.com/canonical/craft-providers";
108     changelog = "https://github.com/canonical/craft-providers/releases/tag/${version}";
109     license = lib.licenses.lgpl3Only;
110     maintainers = with lib.maintainers; [ jnsgruk ];
111     platforms = lib.platforms.linux;
112   };