1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 flit-core,
6 pyproject-hooks,
7 pytestCheckHook,
8 pythonOlder,
9 setuptools,
10 testpath,
11 tomli,
12}:
13
14buildPythonPackage rec {
15 pname = "pyproject-hooks";
16 version = "1.2.0";
17 format = "pyproject";
18
19 disabled = pythonOlder "3.7";
20
21 src = fetchPypi {
22 pname = "pyproject_hooks";
23 inherit version;
24 hash = "sha256-HoWb1cQPrpRIZC3Yca30WeXiCEGG6NLCp5qCTJcNofg=";
25 };
26
27 nativeBuildInputs = [ flit-core ];
28
29 propagatedBuildInputs = lib.optionals (pythonOlder "3.11") [ tomli ];
30
31 # We need to disable tests because this package is part of the bootstrap chain
32 # and its test dependencies cannot be built yet when this is being built.
33 doCheck = false;
34
35 passthru.tests = {
36 pytest = buildPythonPackage {
37 pname = "${pname}-pytest";
38 inherit version;
39 format = "other";
40
41 dontBuild = true;
42 dontInstall = true;
43
44 nativeCheckInputs = [
45 pyproject-hooks
46 pytestCheckHook
47 setuptools
48 testpath
49 ];
50
51 disabledTests = [
52 # fail to import setuptools
53 "test_setup_py"
54 "test_issue_104"
55 ];
56 };
57 };
58
59 pythonImportsCheck = [ "pyproject_hooks" ];
60
61 meta = with lib; {
62 description = "Low-level library for calling build-backends in `pyproject.toml`-based project";
63 homepage = "https://github.com/pypa/pyproject-hooks";
64 changelog = "https://github.com/pypa/pyproject-hooks/blob/v${version}/docs/changelog.rst";
65 license = licenses.mit;
66 teams = [ teams.python ];
67 };
68}