1# Hooks for building Python packages.
2{ python
3, callPackage
4, makeSetupHook
5}:
6
7let
8 pythonInterpreter = python.pythonForBuild.interpreter;
9 pythonSitePackages = python.sitePackages;
10 pythonCheckInterpreter = python.interpreter;
11 setuppy = ../run_setup.py;
12in rec {
13
14 flitBuildHook = callPackage ({ flit }:
15 makeSetupHook {
16 name = "flit-build-hook";
17 deps = [ flit ];
18 substitutions = {
19 inherit pythonInterpreter;
20 };
21 } ./flit-build-hook.sh) {};
22
23 pipBuildHook = callPackage ({ pip }:
24 makeSetupHook {
25 name = "pip-build-hook.sh";
26 deps = [ pip ];
27 substitutions = {
28 inherit pythonInterpreter pythonSitePackages;
29 };
30 } ./pip-build-hook.sh) {};
31
32 pipInstallHook = callPackage ({ pip }:
33 makeSetupHook {
34 name = "pip-install-hook";
35 deps = [ pip ];
36 substitutions = {
37 inherit pythonInterpreter pythonSitePackages;
38 };
39 } ./pip-install-hook.sh) {};
40
41 pytestCheckHook = callPackage ({ pytest }:
42 makeSetupHook {
43 name = "pytest-check-hook";
44 deps = [ pytest ];
45 substitutions = {
46 inherit pythonCheckInterpreter;
47 };
48 } ./pytest-check-hook.sh) {};
49
50 pythonCatchConflictsHook = callPackage ({ setuptools }:
51 makeSetupHook {
52 name = "python-catch-conflicts-hook";
53 deps = [ setuptools ];
54 substitutions = {
55 inherit pythonInterpreter;
56 catchConflicts=../catch_conflicts/catch_conflicts.py;
57 };
58 } ./python-catch-conflicts-hook.sh) {};
59
60 pythonImportsCheckHook = callPackage ({}:
61 makeSetupHook {
62 name = "python-imports-check-hook.sh";
63 substitutions = {
64 inherit pythonCheckInterpreter;
65 };
66 } ./python-imports-check-hook.sh) {};
67
68 pythonRemoveBinBytecodeHook = callPackage ({ }:
69 makeSetupHook {
70 name = "python-remove-bin-bytecode-hook";
71 } ./python-remove-bin-bytecode-hook.sh) {};
72
73 setuptoolsBuildHook = callPackage ({ setuptools, wheel }:
74 makeSetupHook {
75 name = "setuptools-setup-hook";
76 deps = [ setuptools wheel ];
77 substitutions = {
78 inherit pythonInterpreter pythonSitePackages setuppy;
79 };
80 } ./setuptools-build-hook.sh) {};
81
82 setuptoolsCheckHook = callPackage ({ setuptools }:
83 makeSetupHook {
84 name = "setuptools-check-hook";
85 deps = [ setuptools ];
86 substitutions = {
87 inherit pythonCheckInterpreter setuppy;
88 };
89 } ./setuptools-check-hook.sh) {};
90
91 wheelUnpackHook = callPackage ({ wheel }:
92 makeSetupHook {
93 name = "wheel-unpack-hook.sh";
94 deps = [ wheel ];
95 } ./wheel-unpack-hook.sh) {};
96}