@@ -381,14 +381,15 @@ def uninstall_existing(self, package):
381381 if pack is not None :
382382 self .uninstall (pack )
383383
384- def patch_all_shebang (self , to_movable = True , max_exe_size = 999999 ):
384+ def patch_all_shebang (self , to_movable = True , max_exe_size = 999999 , targetdir = "" ):
385385 """make all python launchers relatives"""
386386 import glob
387387 import os
388388 for ffname in glob .glob (r'%s\Scripts\*.exe' % self .target ):
389389 size = os .path .getsize (ffname )
390390 if size <= max_exe_size :
391- utils .patch_shebang_line (ffname , to_movable = to_movable )
391+ utils .patch_shebang_line (ffname , to_movable = to_movable ,
392+ targetdir = targetdir )
392393
393394
394395 def install (self , package , install_options = None ):
@@ -459,17 +460,18 @@ def patch_standard_packages(self, package_name='', to_movable=True):
459460 # rational: https://github.com/pypa/pip/issues/2328
460461 if package_name .lower () == "pip" or package_name == '' :
461462 # ensure pip will create movable launchers
462- # sheb_mov1 = old way up to WinPython 2016-01, sheb_mov2 = new way
463+ # sheb_mov1 = classic way up to WinPython 2016-01
464+ # sheb_mov2 = tried way, but doesn't work for pip (at least)
463465 sheb_fix = " executable = get_executable()"
464466 sheb_mov1 = " executable = os.path.join(os.path.basename(get_executable()))"
465467 sheb_mov2 = " executable = os.path.join('..',os.path.basename(get_executable()))"
466468 if to_movable :
467469 utils .patch_sourcefile (self .target +
468470 r"\Lib\site-packages\pip\_vendor\distlib\scripts.py" ,
469- sheb_fix , sheb_mov2 )
471+ sheb_fix , sheb_mov1 )
470472 utils .patch_sourcefile (self .target +
471473 r"\Lib\site-packages\pip\_vendor\distlib\scripts.py" ,
472- sheb_mov1 , sheb_mov2 )
474+ sheb_mov2 , sheb_mov1 )
473475 else :
474476 utils .patch_sourcefile (self .target +
475477 r"\Lib\site-packages\pip\_vendor\distlib\scripts.py" ,
@@ -479,6 +481,7 @@ def patch_standard_packages(self, package_name='', to_movable=True):
479481 sheb_mov2 , sheb_fix )
480482
481483 # ensure pip wheel will register relative PATH in 'RECORD' files
484+ # will be in standard pip 8.0.3
482485 utils .patch_sourcefile (
483486 self .target + (
484487 r"\Lib\site-packages\pip\wheel.py" ),
0 commit comments