1self: super: with self;
2
3let
4 pythonInterpreter = super.python.pythonForBuild.interpreter;
5 pythonSitePackages = super.python.sitePackages;
6 pythonCheckInterpreter = super.python.interpreter;
7 setuppy = ../run_setup.py;
8in {
9 makePythonHook = args: pkgs.makeSetupHook ({passthru.provides.setupHook = true; } // args);
10
11 condaInstallHook = callPackage ({ makePythonHook, gnutar, lbzip2 }:
12 makePythonHook {
13 name = "conda-install-hook";
14 deps = [ gnutar lbzip2 ];
15 substitutions = {
16 inherit pythonSitePackages;
17 };
18 } ./conda-install-hook.sh) {};
19
20 condaUnpackHook = callPackage ({ makePythonHook }:
21 makePythonHook {
22 name = "conda-unpack-hook";
23 deps = [];
24 } ./conda-unpack-hook.sh) {};
25
26 eggBuildHook = callPackage ({ makePythonHook }:
27 makePythonHook {
28 name = "egg-build-hook.sh";
29 deps = [ ];
30 } ./egg-build-hook.sh) {};
31
32 eggInstallHook = callPackage ({ makePythonHook, setuptools }:
33 makePythonHook {
34 name = "egg-install-hook.sh";
35 deps = [ setuptools ];
36 substitutions = {
37 inherit pythonInterpreter pythonSitePackages;
38 };
39 } ./egg-install-hook.sh) {};
40
41 eggUnpackHook = callPackage ({ makePythonHook, }:
42 makePythonHook {
43 name = "egg-unpack-hook.sh";
44 deps = [ ];
45 } ./egg-unpack-hook.sh) {};
46
47 flitBuildHook = callPackage ({ makePythonHook, flit }:
48 makePythonHook {
49 name = "flit-build-hook";
50 deps = [ flit ];
51 substitutions = {
52 inherit pythonInterpreter;
53 };
54 } ./flit-build-hook.sh) {};
55
56 pipBuildHook = callPackage ({ makePythonHook, pip, wheel }:
57 makePythonHook {
58 name = "pip-build-hook.sh";
59 deps = [ pip wheel ];
60 substitutions = {
61 inherit pythonInterpreter pythonSitePackages;
62 };
63 } ./pip-build-hook.sh) {};
64
65 pipInstallHook = callPackage ({ makePythonHook, pip }:
66 makePythonHook {
67 name = "pip-install-hook";
68 deps = [ pip ];
69 substitutions = {
70 inherit pythonInterpreter pythonSitePackages;
71 };
72 } ./pip-install-hook.sh) {};
73
74 pytestCheckHook = callPackage ({ makePythonHook, pytest }:
75 makePythonHook {
76 name = "pytest-check-hook";
77 deps = [ pytest ];
78 substitutions = {
79 inherit pythonCheckInterpreter;
80 };
81 } ./pytest-check-hook.sh) {};
82
83 pythonCatchConflictsHook = callPackage ({ makePythonHook, setuptools }:
84 makePythonHook {
85 name = "python-catch-conflicts-hook";
86 substitutions = {
87 inherit pythonInterpreter pythonSitePackages setuptools;
88 catchConflicts=../catch_conflicts/catch_conflicts.py;
89 };
90 } ./python-catch-conflicts-hook.sh) {};
91
92 pythonImportsCheckHook = callPackage ({ makePythonHook }:
93 makePythonHook {
94 name = "python-imports-check-hook.sh";
95 substitutions = {
96 inherit pythonCheckInterpreter;
97 };
98 } ./python-imports-check-hook.sh) {};
99
100 pythonNamespacesHook = callPackage ({ makePythonHook, findutils }:
101 makePythonHook {
102 name = "python-namespaces-hook.sh";
103 substitutions = {
104 inherit pythonSitePackages findutils;
105 };
106 } ./python-namespaces-hook.sh) {};
107
108 pythonOutputDistHook = callPackage ({ makePythonHook }:
109 makePythonHook {
110 name = "python-output-dist-hook";
111 } ./python-output-dist-hook.sh ) {};
112
113 pythonRecompileBytecodeHook = callPackage ({ makePythonHook }:
114 makePythonHook {
115 name = "python-recompile-bytecode-hook";
116 substitutions = {
117 inherit pythonInterpreter pythonSitePackages;
118 compileArgs = lib.concatStringsSep " " (["-q" "-f" "-i -"] ++ lib.optionals isPy3k ["-j $NIX_BUILD_CORES"]);
119 bytecodeName = if isPy3k then "__pycache__" else "*.pyc";
120 };
121 } ./python-recompile-bytecode-hook.sh ) {};
122
123 pythonRelaxDepsHook = callPackage ({ makePythonHook, wheel }:
124 makePythonHook {
125 name = "python-relax-deps-hook";
126 deps = [ wheel ];
127 substitutions = {
128 inherit pythonInterpreter;
129 };
130 } ./python-relax-deps-hook.sh) {};
131
132 pythonRemoveBinBytecodeHook = callPackage ({ makePythonHook }:
133 makePythonHook {
134 name = "python-remove-bin-bytecode-hook";
135 } ./python-remove-bin-bytecode-hook.sh) {};
136
137 pythonRemoveTestsDirHook = callPackage ({ makePythonHook }:
138 makePythonHook {
139 name = "python-remove-tests-dir-hook";
140 substitutions = {
141 inherit pythonSitePackages;
142 };
143 } ./python-remove-tests-dir-hook.sh) {};
144
145 setuptoolsBuildHook = callPackage ({ makePythonHook, setuptools, wheel }:
146 makePythonHook {
147 name = "setuptools-setup-hook";
148 deps = [ setuptools wheel ];
149 substitutions = {
150 inherit pythonInterpreter pythonSitePackages setuppy;
151 };
152 } ./setuptools-build-hook.sh) {};
153
154 setuptoolsCheckHook = callPackage ({ makePythonHook, setuptools }:
155 makePythonHook {
156 name = "setuptools-check-hook";
157 deps = [ setuptools ];
158 substitutions = {
159 inherit pythonCheckInterpreter setuppy;
160 };
161 } ./setuptools-check-hook.sh) {};
162
163 unittestCheckHook = callPackage ({ makePythonHook }:
164 makePythonHook {
165 name = "unittest-check-hook";
166 substitutions = {
167 inherit pythonCheckInterpreter;
168 };
169 } ./unittest-check-hook.sh) {};
170
171 venvShellHook = disabledIf (!isPy3k) (callPackage ({ makePythonHook, ensureNewerSourcesForZipFilesHook }:
172 makePythonHook {
173 name = "venv-shell-hook";
174 deps = [ ensureNewerSourcesForZipFilesHook ];
175 substitutions = {
176 inherit pythonInterpreter;
177 };
178 } ./venv-shell-hook.sh) {});
179
180 wheelUnpackHook = callPackage ({ makePythonHook, wheel }:
181 makePythonHook {
182 name = "wheel-unpack-hook.sh";
183 deps = [ wheel ];
184 } ./wheel-unpack-hook.sh) {};
185
186 wrapPython = callPackage ../wrap-python.nix {
187 inherit (pkgs.buildPackages) makeWrapper;
188 };
189
190 sphinxHook = callPackage ({ makePythonHook, sphinx, installShellFiles }:
191 makePythonHook {
192 name = "python${python.pythonVersion}-sphinx-hook";
193 deps = [ sphinx installShellFiles ];
194 } ./sphinx-hook.sh) {};
195}