silx: 2.1.1 -> 2.1.2 (#361612)
[NixPkgs.git] / pkgs / development / python-modules / craft-providers / default.nix
blob52ecfa0e6c2363f7808768ee53adbc720d89c2ca
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   pytest-logdog,
21 buildPythonPackage rec {
22   pname = "craft-providers";
23   version = "2.0.4";
25   pyproject = true;
27   src = fetchFromGitHub {
28     owner = "canonical";
29     repo = "craft-providers";
30     rev = "refs/tags/${version}";
31     hash = "sha256-f+0AEoVUFL/+v4sRYirc6OD5dYH4dlLk8h7im+CLuhM=";
32   };
34   patches = [
35     # This lib will try to inject snaps *from the host system* into the build
36     # system. This patch short-circuits that logic and ensures that snaps are
37     # installed on the build system from the snap store - because there is no
38     # snapd on NixOS hosts that can be used for the injection. This patch will
39     # likely never be accepted upstream.
40     ./inject-snaps.patch
41   ];
43   postPatch = ''
44     substituteInPlace craft_providers/lxd/installer.py \
45       --replace-fail "/var/snap/lxd/common/lxd/unix.socket" "/var/lib/lxd/unix.socket"
47     substituteInPlace craft_providers/__init__.py \
48       --replace-fail "dev" "${version}"
50     # The urllib3 incompat: https://github.com/msabramo/requests-unixsocket/pull/69
51     # This is already patched in nixpkgs.
52     substituteInPlace pyproject.toml \
53       --replace-fail "setuptools==73.0.1" "setuptools"
54   '';
56   pythonRelaxDeps = [ "requests" ];
58   build-system = [ setuptools-scm ];
60   dependencies = [
61     packaging
62     platformdirs
63     pydantic
64     pyyaml
65     requests-unixsocket
66   ];
68   pythonImportsCheck = [ "craft_providers" ];
70   nativeCheckInputs = [
71     freezegun
72     pytest-check
73     pytest-mock
74     pytest-subprocess
75     pytest-logdog
76     pytestCheckHook
77     responses
78   ];
80   preCheck = ''
81     mkdir -p check-phase
82     export HOME="$(pwd)/check-phase"
83   '';
85   pytestFlagsArray = [ "tests/unit" ];
87   disabledTestPaths = [
88     # Relies upon "logassert" python package which isn't in nixpkgs
89     "tests/unit/bases/test_ubuntu_buildd.py"
90     "tests/unit/bases/test_centos_7.py"
91     "tests/unit/bases/test_almalinux.py"
92     "tests/unit/actions/test_snap_installer.py"
93     # Relies upon "pytest-time" python package which isn't in nixpkgs
94     "tests/unit/multipass"
95     "tests/unit/lxd"
96     "tests/unit/test_base.py"
97     "tests/unit/util/test_retry.py"
98   ];
100   passthru.updateScript = nix-update-script { };
102   meta = {
103     description = "Interfaces for instantiating and controlling a variety of build environments";
104     homepage = "https://github.com/canonical/craft-providers";
105     changelog = "https://github.com/canonical/craft-providers/releases/tag/${version}";
106     license = lib.licenses.lgpl3Only;
107     maintainers = with lib.maintainers; [ jnsgruk ];
108     platforms = lib.platforms.linux;
109   };