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