@@ -125,7 +125,7 @@ def write_nodejs_wheel(out_dir, *, node_version, version, platform, archive):
125125
126126 if entry_name in NODE_BINS :
127127 # entry_points['node'] = 'nodejs.node:main'
128- init_imports .append ('from . import node' )
128+ init_imports .append ('from . import node as node ' )
129129 contents ['nodejs/node.py' ] = cleandoc (f"""
130130 import os, sys, subprocess
131131 from typing import TYPE_CHECKING
@@ -169,8 +169,8 @@ def main() -> None:
169169 main()
170170 """ ).encode ('ascii' )
171171 elif entry_name in NODE_OTHER_BINS and NODE_OTHER_BINS [entry_name ][1 ]:
172- # entry_points[NODE_OTHER_BINS[entry_name][0]] = f'nodejs.{ NODE_OTHER_BINS[entry_name][0]}:main'
173- init_imports .append (f'from . import { NODE_OTHER_BINS [ entry_name ][ 0 ] } ' )
172+ other_bin = NODE_OTHER_BINS [entry_name ][0 ]
173+ init_imports .append (f'from . import { other_bin } as { other_bin } ' )
174174 script_name = '/' .join (os .path .normpath (os .path .join (os .path .dirname (entry .name ), entry .linkpath )).split ('/' )[1 :])
175175 contents [f'nodejs/{ NODE_OTHER_BINS [entry_name ][0 ]} .py' ] = cleandoc (f"""
176176 import os, sys
@@ -208,8 +208,8 @@ def main() -> None:
208208 main()
209209 """ ).encode ('ascii' )
210210 elif entry_name in NODE_OTHER_BINS :
211- # entry_points[NODE_OTHER_BINS[entry_name][0]] = f'nodejs.{ NODE_OTHER_BINS[entry_name][0]}:main'
212- init_imports .append (f'from . import { NODE_OTHER_BINS [ entry_name ][ 0 ] } ' )
211+ other_bin = NODE_OTHER_BINS [entry_name ][0 ]
212+ init_imports .append (f'from . import { other_bin } as { other_bin } ' )
213213 contents [f'nodejs/{ NODE_OTHER_BINS [entry_name ][0 ]} .py' ] = cleandoc (f"""
214214 import os, sys, subprocess
215215 from typing import TYPE_CHECKING
@@ -246,7 +246,7 @@ def main() -> None:
246246 """ ).encode ('ascii' )
247247
248248 contents ['nodejs/__init__.py' ] = (cleandoc ("""
249- from .node import path, main, call, run, Popen
249+ from .node import path as path , main as main , call as call , run as run, Popen as Popen
250250 {init_imports}
251251
252252 __version__ = "{version}"
@@ -256,6 +256,7 @@ def main() -> None:
256256 version = version ,
257257 node_version = node_version ,
258258 ).encode ('ascii' )
259+ contents ['nodejs/py.typed' ] = b''
259260
260261 with open ('README.md' ) as f :
261262 description = f .read ()
0 commit comments