1{
2 lib,
3 buildPythonPackage,
4 annotated-types,
5 distro,
6 fetchFromGitHub,
7 nix-update-script,
8 hypothesis,
9 pytest-check,
10 pytestCheckHook,
11 pythonOlder,
12 setuptools-scm,
13}:
14
15buildPythonPackage rec {
16 pname = "craft-platforms";
17 version = "0.8.0";
18 pyproject = true;
19
20 disabled = pythonOlder "3.10";
21
22 src = fetchFromGitHub {
23 owner = "canonical";
24 repo = "craft-platforms";
25 tag = version;
26 hash = "sha256-U57hmQ3UPuwoue8kAxAXiH8ecViryFqIxmpnaAdQnZo=";
27 };
28
29 postPatch = ''
30 substituteInPlace craft_platforms/__init__.py --replace-fail "dev" "${version}"
31 '';
32
33 build-system = [ setuptools-scm ];
34
35 dependencies = [
36 annotated-types
37 distro
38 ];
39
40 nativeCheckInputs = [
41 hypothesis
42 pytestCheckHook
43 pytest-check
44 ];
45
46 pythonImportsCheck = [ "craft_platforms" ];
47
48 pytestFlagsArray = [ "tests/unit" ];
49
50 disabledTests = [
51 # Attempts to get distro information, and expects "ubuntu-ish"
52 # information to be returned, which doesn't work under NixOS
53 "test_fuzz_get_platforms_build_plan_single_base"
54 ];
55
56 passthru.updateScript = nix-update-script { };
57
58 meta = {
59 description = "Manage platforms and architectures for charm applications";
60 homepage = "https://github.com/canonical/craft-platforms";
61 changelog = "https://github.com/canonical/craft-platforms/releases/tag/${version}";
62 license = lib.licenses.lgpl3Only;
63 maintainers = with lib.maintainers; [ jnsgruk ];
64 platforms = lib.platforms.linux;
65 };
66}