99
1010
1111# Versions to build if run as a script:
12- BUILD_VERSIONS = ('14.19.3' ,) # '16.15.1', '18.4.0')
12+ BUILD_VERSIONS = ('14.19.3' , '16.15.1' , '18.4.0' )
1313
1414# Suffix to append to the Wheel
1515# For pre release versions this should be 'aN', e.g. 'a1'
3838
3939# Mapping of node platforms to Python platforms
4040PLATFORMS = {
41- # 'win-x86': 'win32',
42- # 'win-x64': 'win_amd64',
41+ 'win-x86' : 'win32' ,
42+ 'win-x64' : 'win_amd64' ,
4343 'darwin-x64' : 'macosx_10_9_x86_64' ,
44- # 'darwin-arm64': 'macosx_11_0_arm64',
45- # 'linux-x64': 'manylinux_2_12_x86_64.manylinux2010_x86_64',
46- # 'linux-armv7l': 'manylinux_2_17_armv7l.manylinux2014_armv7l',
47- # 'linux-arm64': 'manylinux_2_17_aarch64.manylinux2014_aarch64',
44+ 'darwin-arm64' : 'macosx_11_0_arm64' ,
45+ 'linux-x64' : 'manylinux_2_12_x86_64.manylinux2010_x86_64' ,
46+ 'linux-armv7l' : 'manylinux_2_17_armv7l.manylinux2014_armv7l' ,
47+ 'linux-arm64' : 'manylinux_2_17_aarch64.manylinux2014_aarch64' ,
4848}
4949
5050
@@ -128,30 +128,37 @@ def write_nodejs_wheel(out_dir, *, node_version, version, platform, archive):
128128 init_imports .append ('from . import node' )
129129 contents ['nodejs/node.py' ] = cleandoc (f"""
130130 import os, sys, subprocess
131+ from typing import TYPE_CHECKING
131132
132133 path = os.path.join(os.path.dirname(__file__), "{ entry_name } ")
133134
134- def call(args, **kwargs):
135- return subprocess.call([
136- path,
137- *args
138- ], **kwargs)
139-
140- def run(args, **kwargs):
141- return subprocess.run([
142- path,
143- *args
144- ], **kwargs)
145-
146- def Popen(args, **kwargs):
147- return subprocess.Popen([
148- path,
149- *args
150- ], **kwargs)
151-
152- def main():
135+ if TYPE_CHECKING:
136+ call = subprocess.call
137+ run = subprocess.run
138+ Popen = subprocess.Popen
139+
140+ else:
141+ def call(args, **kwargs):
142+ return subprocess.call([
143+ path,
144+ *args
145+ ], **kwargs)
146+
147+ def run(args, **kwargs):
148+ return subprocess.run([
149+ path,
150+ *args
151+ ], **kwargs)
152+
153+ def Popen(args, **kwargs):
154+ return subprocess.Popen([
155+ path,
156+ *args
157+ ], **kwargs)
158+
159+ def main() -> None:
153160 sys.exit(call(sys.argv[1:]))
154-
161+
155162 if __name__ == '__main__':
156163 main()
157164 """ ).encode ('ascii' )
@@ -167,27 +174,34 @@ def main():
167174 script_name = '/' .join (os .path .normpath (os .path .join (os .path .dirname (entry .name ), entry .linkpath )).split ('/' )[1 :])
168175 contents [f'nodejs/{ NODE_OTHER_BINS [entry_name ][0 ]} .py' ] = cleandoc (f"""
169176 import os, sys
177+ from typing import TYPE_CHECKING
170178 from . import node
171179
172- def call(args, **kwargs):
173- return node.call([
174- os.path.join(os.path.dirname(__file__), "{ script_name } "),
175- *args
176- ], **kwargs)
177-
178- def run(args, **kwargs):
179- return node.run([
180- os.path.join(os.path.dirname(__file__), "{ script_name } "),
181- *args
182- ], **kwargs)
180+ if TYPE_CHECKING:
181+ call = subprocess.call
182+ run = subprocess.run
183+ Popen = subprocess.Popen
184+
185+ else:
186+ def call(args, **kwargs):
187+ return node.call([
188+ os.path.join(os.path.dirname(__file__), "{ script_name } "),
189+ *args
190+ ], **kwargs)
191+
192+ def run(args, **kwargs):
193+ return node.run([
194+ os.path.join(os.path.dirname(__file__), "{ script_name } "),
195+ *args
196+ ], **kwargs)
197+
198+ def Popen(args, **kwargs):
199+ return node.Popen([
200+ os.path.join(os.path.dirname(__file__), "{ script_name } "),
201+ *args
202+ ], **kwargs)
183203
184- def Popen(args, **kwargs):
185- return node.Popen([
186- os.path.join(os.path.dirname(__file__), "{ script_name } "),
187- *args
188- ], **kwargs)
189-
190- def main():
204+ def main() -> None:
191205 sys.exit(call(sys.argv[1:]))
192206
193207 if __name__ == '__main__':
@@ -198,26 +212,33 @@ def main():
198212 init_imports .append (f'from . import { NODE_OTHER_BINS [entry_name ][0 ]} ' )
199213 contents [f'nodejs/{ NODE_OTHER_BINS [entry_name ][0 ]} .py' ] = cleandoc (f"""
200214 import os, sys, subprocess
201-
202- def call(args, **kwargs):
203- return subprocess.call([
204- os.path.join(os.path.dirname(__file__), "{ entry_name } "),
205- *args
206- ], **kwargs)
207-
208- def run(args, **kwargs):
209- return subprocess.run([
210- os.path.join(os.path.dirname(__file__), "{ entry_name } "),
211- *args
212- ], **kwargs)
213-
214- def Popen(args, **kwargs):
215- return subprocess.Popen([
216- os.path.join(os.path.dirname(__file__), "{ entry_name } "),
217- *args
218- ], **kwargs)
215+ from typing import TYPE_CHECKING
216+
217+ if TYPE_CHECKING:
218+ call = subprocess.call
219+ run = subprocess.run
220+ Popen = subprocess.Popen
221+
222+ else:
223+ def call(args, **kwargs):
224+ return subprocess.call([
225+ os.path.join(os.path.dirname(__file__), "{ entry_name } "),
226+ *args
227+ ], **kwargs)
228+
229+ def run(args, **kwargs):
230+ return subprocess.run([
231+ os.path.join(os.path.dirname(__file__), "{ entry_name } "),
232+ *args
233+ ], **kwargs)
234+
235+ def Popen(args, **kwargs):
236+ return subprocess.Popen([
237+ os.path.join(os.path.dirname(__file__), "{ entry_name } "),
238+ *args
239+ ], **kwargs)
219240
220- def main():
241+ def main() -> None :
221242 sys.exit(call(sys.argv[1:]))
222243
223244 if __name__ == '__main__':
0 commit comments