summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/build/default.nix
blob: 5764651403a0f6a91d2043b0cc8c92de31cb3ff5 (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
{
  lib,
  stdenv,
  build,
  buildPythonPackage,
  fetchFromGitHub,
  flit-core,
  filelock,
  packaging,
  pyproject-hooks,
  pytest-mock,
  pytest-rerunfailures,
  pytest-xdist,
  pytestCheckHook,
  setuptools,
  uv,
  virtualenv,
  wheel,
}:

buildPythonPackage rec {
  pname = "build";
  version = "1.4.4";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "pypa";
    repo = "build";
    tag = version;
    hash = "sha256-QprU0sXL6FL0rSVJwu8cYpcPlnYKzKAbkyDaTV778js=";
  };

  build-system = [ flit-core ];

  pythonRemoveDeps = [ "importlib-metadata" ];

  dependencies = [
    packaging
    pyproject-hooks
  ];

  # We need to disable tests because this package is part of the bootstrap chain
  # and its test dependencies cannot be built yet when this is being built.
  doCheck = false;

  passthru.tests = {
    pytest = buildPythonPackage {
      pname = "${pname}-pytest";
      inherit src version;
      pyproject = false;

      dontBuild = true;
      dontInstall = true;

      nativeCheckInputs = [
        build
        filelock
        pytest-mock
        pytest-rerunfailures
        pytest-xdist
        pytestCheckHook
        setuptools
        uv
        virtualenv
        wheel
      ];

      pytestFlags = [
        "-Wignore::DeprecationWarning"
      ];

      __darwinAllowLocalNetworking = true;

      disabledTests = [
        # Tests often fail with StopIteration
        "test_isolat"
        "test_default_pip_is_never_too_old"
        "test_build"
        "test_with_get_requires"
        "test_init"
        "test_output"
        "test_wheel_metadata"
        # Tests require network access to run pip install
        "test_logging_output"
        "test_pythonpath_does_not_interfere_with_outer_pip"
        "test_requirement_installation"
        "test_verbose_logging_output"
        "test_verbose_output"
      ]
      ++ lib.optionals stdenv.hostPlatform.isDarwin [
        # Expects Apple's Python and its quirks
        "test_can_get_venv_paths_with_conflicting_default_scheme"
      ];
    };
  };

  pythonImportsCheck = [ "build" ];

  meta = {
    mainProgram = "pyproject-build";
    description = "Simple, correct PEP517 package builder";
    longDescription = ''
      build will invoke the PEP 517 hooks to build a distribution package. It
      is a simple build tool and does not perform any dependency management.
    '';
    homepage = "https://github.com/pypa/build";
    changelog = "https://github.com/pypa/build/blob/${src.tag}/CHANGELOG.rst";
    license = lib.licenses.mit;
    maintainers = [ lib.maintainers.fab ];
    teams = [ lib.teams.python ];
  };
}