1- # Hooks for building Python packages.
2- { python
3- , lib
4- , makeSetupHook
5- , disabledIf
6- , isPy3k
7- } :
1+ self : super : with self ;
82
93let
10- callPackage = python . pythonForBuild . pkgs . callPackage ;
11- pythonInterpreter = python . pythonForBuild . interpreter ;
12- pythonSitePackages = python . sitePackages ;
13- pythonCheckInterpreter = python . interpreter ;
4+ pythonInterpreter = super . python . pythonForBuild . interpreter ;
5+ pythonSitePackages = super . python . sitePackages ;
6+ pythonCheckInterpreter = super . python . interpreter ;
147 setuppy = ../run_setup.py ;
15- in rec {
8+ in {
9+ makePythonHook = args : pkgs . makeSetupHook ( { passthru . provides . setupHook = true ; } // args ) ;
1610
17- condaInstallHook = callPackage ( { gnutar , lbzip2 } :
18- makeSetupHook {
11+ condaInstallHook = callPackage ( { makePythonHook , gnutar , lbzip2 } :
12+ makePythonHook {
1913 name = "conda-install-hook" ;
2014 deps = [ gnutar lbzip2 ] ;
2115 substitutions = {
2216 inherit pythonSitePackages ;
2317 } ;
2418 } ./conda-install-hook.sh ) { } ;
2519
26- condaUnpackHook = callPackage ( { } :
27- makeSetupHook {
20+ condaUnpackHook = callPackage ( { makePythonHook } :
21+ makePythonHook {
2822 name = "conda-unpack-hook" ;
2923 deps = [ ] ;
3024 } ./conda-unpack-hook.sh ) { } ;
3125
32- eggBuildHook = callPackage ( { } :
33- makeSetupHook {
26+ eggBuildHook = callPackage ( { makePythonHook } :
27+ makePythonHook {
3428 name = "egg-build-hook.sh" ;
3529 deps = [ ] ;
3630 } ./egg-build-hook.sh ) { } ;
3731
38- eggInstallHook = callPackage ( { setuptools } :
39- makeSetupHook {
32+ eggInstallHook = callPackage ( { makePythonHook , setuptools } :
33+ makePythonHook {
4034 name = "egg-install-hook.sh" ;
4135 deps = [ setuptools ] ;
4236 substitutions = {
4337 inherit pythonInterpreter pythonSitePackages ;
4438 } ;
4539 } ./egg-install-hook.sh ) { } ;
4640
47- eggUnpackHook = callPackage ( { } :
48- makeSetupHook {
41+ eggUnpackHook = callPackage ( { makePythonHook , } :
42+ makePythonHook {
4943 name = "egg-unpack-hook.sh" ;
5044 deps = [ ] ;
5145 } ./egg-unpack-hook.sh ) { } ;
5246
53- flitBuildHook = callPackage ( { flit } :
54- makeSetupHook {
47+ flitBuildHook = callPackage ( { makePythonHook , flit } :
48+ makePythonHook {
5549 name = "flit-build-hook" ;
5650 deps = [ flit ] ;
5751 substitutions = {
5852 inherit pythonInterpreter ;
5953 } ;
6054 } ./flit-build-hook.sh ) { } ;
6155
62- pipBuildHook = callPackage ( { pip , wheel } :
63- makeSetupHook {
56+ pipBuildHook = callPackage ( { makePythonHook , pip , wheel } :
57+ makePythonHook {
6458 name = "pip-build-hook.sh" ;
6559 deps = [ pip wheel ] ;
6660 substitutions = {
6761 inherit pythonInterpreter pythonSitePackages ;
6862 } ;
6963 } ./pip-build-hook.sh ) { } ;
7064
71- pipInstallHook = callPackage ( { pip } :
72- makeSetupHook {
65+ pipInstallHook = callPackage ( { makePythonHook , pip } :
66+ makePythonHook {
7367 name = "pip-install-hook" ;
7468 deps = [ pip ] ;
7569 substitutions = {
7670 inherit pythonInterpreter pythonSitePackages ;
7771 } ;
7872 } ./pip-install-hook.sh ) { } ;
7973
80- pytestCheckHook = callPackage ( { pytest } :
81- makeSetupHook {
74+ pytestCheckHook = callPackage ( { makePythonHook , pytest } :
75+ makePythonHook {
8276 name = "pytest-check-hook" ;
8377 deps = [ pytest ] ;
8478 substitutions = {
8579 inherit pythonCheckInterpreter ;
8680 } ;
8781 } ./pytest-check-hook.sh ) { } ;
8882
89- pythonCatchConflictsHook = callPackage ( { setuptools } :
90- makeSetupHook {
83+ pythonCatchConflictsHook = callPackage ( { makePythonHook , setuptools } :
84+ makePythonHook {
9185 name = "python-catch-conflicts-hook" ;
9286 substitutions = {
9387 inherit pythonInterpreter pythonSitePackages setuptools ;
9488 catchConflicts = ../catch_conflicts/catch_conflicts.py ;
9589 } ;
9690 } ./python-catch-conflicts-hook.sh ) { } ;
9791
98- pythonImportsCheckHook = callPackage ( { } :
99- makeSetupHook {
92+ pythonImportsCheckHook = callPackage ( { makePythonHook } :
93+ makePythonHook {
10094 name = "python-imports-check-hook.sh" ;
10195 substitutions = {
10296 inherit pythonCheckInterpreter ;
10397 } ;
10498 } ./python-imports-check-hook.sh ) { } ;
10599
106- pythonNamespacesHook = callPackage ( { findutils } :
107- makeSetupHook {
100+ pythonNamespacesHook = callPackage ( { makePythonHook , findutils } :
101+ makePythonHook {
108102 name = "python-namespaces-hook.sh" ;
109103 substitutions = {
110104 inherit pythonSitePackages findutils ;
111105 } ;
112106 } ./python-namespaces-hook.sh ) { } ;
113107
114- pythonOutputDistHook = callPackage ( { } :
115- makeSetupHook {
108+ pythonOutputDistHook = callPackage ( { makePythonHook } :
109+ makePythonHook {
116110 name = "python-output-dist-hook" ;
117111 } ./python-output-dist-hook.sh ) { } ;
118112
119- pythonRecompileBytecodeHook = callPackage ( { } :
120- makeSetupHook {
113+ pythonRecompileBytecodeHook = callPackage ( { makePythonHook } :
114+ makePythonHook {
121115 name = "python-recompile-bytecode-hook" ;
122116 substitutions = {
123117 inherit pythonInterpreter pythonSitePackages ;
@@ -126,71 +120,75 @@ in rec {
126120 } ;
127121 } ./python-recompile-bytecode-hook.sh ) { } ;
128122
129- pythonRelaxDepsHook = callPackage ( { wheel } :
130- makeSetupHook {
123+ pythonRelaxDepsHook = callPackage ( { makePythonHook , wheel } :
124+ makePythonHook {
131125 name = "python-relax-deps-hook" ;
132126 deps = [ wheel ] ;
133127 substitutions = {
134128 inherit pythonInterpreter ;
135129 } ;
136130 } ./python-relax-deps-hook.sh ) { } ;
137131
138- pythonRemoveBinBytecodeHook = callPackage ( { } :
139- makeSetupHook {
132+ pythonRemoveBinBytecodeHook = callPackage ( { makePythonHook } :
133+ makePythonHook {
140134 name = "python-remove-bin-bytecode-hook" ;
141135 } ./python-remove-bin-bytecode-hook.sh ) { } ;
142136
143- pythonRemoveTestsDirHook = callPackage ( { } :
144- makeSetupHook {
137+ pythonRemoveTestsDirHook = callPackage ( { makePythonHook } :
138+ makePythonHook {
145139 name = "python-remove-tests-dir-hook" ;
146140 substitutions = {
147141 inherit pythonSitePackages ;
148142 } ;
149143 } ./python-remove-tests-dir-hook.sh ) { } ;
150144
151- setuptoolsBuildHook = callPackage ( { setuptools , wheel } :
152- makeSetupHook {
145+ setuptoolsBuildHook = callPackage ( { makePythonHook , setuptools , wheel } :
146+ makePythonHook {
153147 name = "setuptools-setup-hook" ;
154148 deps = [ setuptools wheel ] ;
155149 substitutions = {
156150 inherit pythonInterpreter pythonSitePackages setuppy ;
157151 } ;
158152 } ./setuptools-build-hook.sh ) { } ;
159153
160- setuptoolsCheckHook = callPackage ( { setuptools } :
161- makeSetupHook {
154+ setuptoolsCheckHook = callPackage ( { makePythonHook , setuptools } :
155+ makePythonHook {
162156 name = "setuptools-check-hook" ;
163157 deps = [ setuptools ] ;
164158 substitutions = {
165159 inherit pythonCheckInterpreter setuppy ;
166160 } ;
167161 } ./setuptools-check-hook.sh ) { } ;
168162
169- unittestCheckHook = callPackage ( { } :
170- makeSetupHook {
163+ unittestCheckHook = callPackage ( { makePythonHook } :
164+ makePythonHook {
171165 name = "unittest-check-hook" ;
172166 substitutions = {
173167 inherit pythonCheckInterpreter ;
174168 } ;
175169 } ./unittest-check-hook.sh ) { } ;
176170
177- venvShellHook = disabledIf ( ! isPy3k ) ( callPackage ( { ensureNewerSourcesForZipFilesHook } :
178- makeSetupHook {
171+ venvShellHook = disabledIf ( ! isPy3k ) ( callPackage ( { makePythonHook , ensureNewerSourcesForZipFilesHook } :
172+ makePythonHook {
179173 name = "venv-shell-hook" ;
180174 deps = [ ensureNewerSourcesForZipFilesHook ] ;
181175 substitutions = {
182176 inherit pythonInterpreter ;
183177 } ;
184178 } ./venv-shell-hook.sh ) { } ) ;
185179
186- wheelUnpackHook = callPackage ( { wheel } :
187- makeSetupHook {
180+ wheelUnpackHook = callPackage ( { makePythonHook , wheel } :
181+ makePythonHook {
188182 name = "wheel-unpack-hook.sh" ;
189183 deps = [ wheel ] ;
190184 } ./wheel-unpack-hook.sh ) { } ;
191185
192- sphinxHook = callPackage ( { sphinx , installShellFiles } :
193- makeSetupHook {
186+ wrapPython = callPackage ../wrap-python.nix {
187+ inherit ( pkgs . buildPackages ) makeWrapper ;
188+ } ;
189+
190+ sphinxHook = callPackage ( { makePythonHook , sphinx , installShellFiles } :
191+ makePythonHook {
194192 name = "python${ python . pythonVersion } -sphinx-hook" ;
195193 deps = [ sphinx installShellFiles ] ;
196194 } ./sphinx-hook.sh ) { } ;
0 commit comments