File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
src/pip/_internal/operations/install Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -412,6 +412,19 @@ def _raise_for_invalid_entrypoint(specification: str) -> None:
412
412
413
413
414
414
class PipScriptMaker (ScriptMaker ):
415
+ # Override distlib's default script template with one that
416
+ # doesn't import `re` module, allowing scripts to load faster.
417
+ script_template = r"""# -*- coding: utf-8 -*-
418
+ import sys
419
+ from %(module)s import %(import_name)s
420
+ if __name__ == '__main__':
421
+ if sys.argv[0].endswith('-script.pyw'):
422
+ sys.argv[0] = sys.argv[0][: -11]
423
+ elif sys.argv[0].endswith('.exe'):
424
+ sys.argv[0] = sys.argv[0][: -4]
425
+ sys.exit(%(func)s())
426
+ """
427
+
415
428
def make (
416
429
self , specification : str , options : Optional [Dict [str , Any ]] = None
417
430
) -> List [str ]:
You can’t perform that action at this time.
0 commit comments