Skip to content

Commit d16696e

Browse files
committed
Merge pull request #261 from stonebig/master
revert shebang failed improvement
2 parents c04c193 + dbfcba5 commit d16696e

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

winpython/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ def get_python_long_version(path):
290290
# =============================================================================
291291
# Patch chebang line (courtesy of Christoph Gohlke)
292292
# =============================================================================
293-
def patch_shebang_line(fname, pad=b' ', to_movable=True, targetdir="..\\"):
293+
def patch_shebang_line(fname, pad=b' ', to_movable=True, targetdir=""):
294294
"""Remove absolute path to python.exe in shebang lines, or re-add it"""
295295

296296
import re

winpython/wppm.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)