1{
2 lib,
3 stdenv,
4 build,
5 buildPythonPackage,
6 fetchFromGitHub,
7 flit-core,
8 filelock,
9 packaging,
10 pyproject-hooks,
11 pytest-mock,
12 pytest-rerunfailures,
13 pytest-xdist,
14 pytestCheckHook,
15 pythonOlder,
16 setuptools,
17 tomli,
18 virtualenv,
19 wheel,
20}:
21
22buildPythonPackage rec {
23 pname = "build";
24 version = "1.3.0";
25 pyproject = true;
26
27 src = fetchFromGitHub {
28 owner = "pypa";
29 repo = "build";
30 tag = version;
31 hash = "sha256-w2YKQzni8e6rpnQJH2J0bHzRigjWOlWiI8Po5d3ZqS8=";
32 };
33
34 build-system = [ flit-core ];
35
36 pythonRemoveDeps = [ "importlib-metadata" ];
37
38 dependencies = [
39 packaging
40 pyproject-hooks
41 ]
42 ++ lib.optionals (pythonOlder "3.11") [ tomli ];
43
44 # We need to disable tests because this package is part of the bootstrap chain
45 # and its test dependencies cannot be built yet when this is being built.
46 doCheck = false;
47
48 passthru.tests = {
49 pytest = buildPythonPackage {
50 pname = "${pname}-pytest";
51 inherit src version;
52 format = "other";
53
54 dontBuild = true;
55 dontInstall = true;
56
57 nativeCheckInputs = [
58 build
59 filelock
60 pytest-mock
61 pytest-rerunfailures
62 pytest-xdist
63 pytestCheckHook
64 setuptools
65 virtualenv
66 wheel
67 ];
68
69 pytestFlags = [
70 "-Wignore::DeprecationWarning"
71 ];
72
73 __darwinAllowLocalNetworking = true;
74
75 disabledTests = [
76 # Tests often fail with StopIteration
77 "test_isolat"
78 "test_default_pip_is_never_too_old"
79 "test_build"
80 "test_with_get_requires"
81 "test_init"
82 "test_output"
83 "test_wheel_metadata"
84 # Tests require network access to run pip install
85 "test_verbose_output"
86 "test_requirement_installation"
87 ]
88 ++ lib.optionals stdenv.hostPlatform.isDarwin [
89 # Expects Apple's Python and its quirks
90 "test_can_get_venv_paths_with_conflicting_default_scheme"
91 ];
92 };
93 };
94
95 pythonImportsCheck = [ "build" ];
96
97 meta = with lib; {
98 mainProgram = "pyproject-build";
99 description = "Simple, correct PEP517 package builder";
100 longDescription = ''
101 build will invoke the PEP 517 hooks to build a distribution package. It
102 is a simple build tool and does not perform any dependency management.
103 '';
104 homepage = "https://github.com/pypa/build";
105 changelog = "https://github.com/pypa/build/blob/${src.tag}/CHANGELOG.rst";
106 license = licenses.mit;
107 maintainers = [ maintainers.fab ];
108 teams = [ teams.python ];
109 };
110}