summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/craft-parts/default.nix
blob: c3601041d17c8cc964d4bd4e6b46caac6d51ed13 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  nix-update-script,
  overrides,
  pydantic,
  pyxdg,
  pyyaml,
  requests,
  requests-unixsocket,
  pytestCheckHook,
  pytest-check,
  pytest-mock,
  pytest-subprocess,
  requests-mock,
  hypothesis,
  jsonschema,
  git,
  squashfsTools,
  socat,
  setuptools-scm,
  stdenv,
  ant,
  maven,
  jdk,
}:

buildPythonPackage rec {
  pname = "craft-parts";
  version = "2.7.0";

  pyproject = true;

  src = fetchFromGitHub {
    owner = "canonical";
    repo = "craft-parts";
    tag = version;
    hash = "sha256-Diu8cHy3tRWsyI7mPsAcYREK9nUG7tzasmZYAARzpXU=";
  };

  patches = [ ./bash-path.patch ];

  build-system = [ setuptools-scm ];

  pythonRelaxDeps = [
    "requests"
    "urllib3"
    "pydantic"
  ];

  dependencies = [
    overrides
    pydantic
    pyxdg
    pyyaml
    requests
    requests-unixsocket
  ];

  pythonImportsCheck = [ "craft_parts" ];

  nativeCheckInputs = [
    ant
    git
    hypothesis
    jdk
    jsonschema
    maven
    pytest-check
    pytest-mock
    pytest-subprocess
    pytestCheckHook
    requests-mock
    socat
    squashfsTools
  ];

  pytestFlagsArray = [ "tests/unit" ];

  preCheck = ''
    export HOME=$(mktemp -d)
  '';

  disabledTests = [
    # Relies upon paths not present in Nix (like /bin/bash)
    "test_run_builtin_build"
    "test_run_prime"
    "test_get_build_packages_with_source_type"
    "test_get_build_packages"
    # Relies upon certain paths being present that don't make sense on Nix.
    "test_java_plugin_jre_not_17"
  ];

  disabledTestPaths =
    [
      # Relies upon filesystem extended attributes, and suid/guid bits
      "tests/unit/sources/test_base.py"
      "tests/unit/packages/test_base.py"
      "tests/unit/state_manager"
      "tests/unit/test_xattrs.py"
      "tests/unit/packages/test_normalize.py"
      # Relies upon presence of apt/dpkg.
      "tests/unit/packages/test_apt_cache.py"
      "tests/unit/packages/test_deb.py"
      "tests/unit/packages/test_chisel.py"
    ]
    ++ lib.optionals stdenv.hostPlatform.isAarch64 [
      # These tests have hardcoded "amd64" strings which fail on aarch64
      "tests/unit/executor/test_environment.py"
      "tests/unit/features/overlay/test_executor_environment.py"
    ];

  passthru.updateScript = nix-update-script { };

  meta = {
    description = "Software artifact parts builder from Canonical";
    homepage = "https://github.com/canonical/craft-parts";
    changelog = "https://github.com/canonical/craft-parts/releases/tag/${src.tag}";
    license = lib.licenses.lgpl3Only;
    maintainers = with lib.maintainers; [ jnsgruk ];
    platforms = lib.platforms.linux;
  };
}