Skip to content

Commit d2b8331

Browse files
author
stonebig
committed
re-arrange build process for requirements.txt use
1 parent d779f73 commit d2b8331

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

make.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -764,16 +764,18 @@ def make(self, remove_existing=True):
764764
self._add_msvc_files()
765765
if not self.simulation:
766766
self._create_batch_scripts_initial()
767+
self._create_batch_scripts() # which set mingwpy as compiler
767768
self._run_complement_batch_scripts("run_required_first.bat")
768769
self._install_required_packages()
769770
self._install_all_other_packages()
770771
if not self.simulation:
771772
self._copy_dev_tools()
772773
self._copy_dev_docs()
773774
if not self.simulation:
775+
self._run_complement_batch_scripts() # run_complement.bat
776+
self.distribution.patch_all_shebang()
777+
# launchers at the very end
774778
self._create_launchers()
775-
self._create_batch_scripts()
776-
self._run_complement_batch_scripts()
777779

778780
if remove_existing and not self.simulation:
779781
self._print("Cleaning up distribution")

winpython/wppm.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,16 @@ def uninstall_existing(self, package):
366366
if pack is not None:
367367
self.uninstall(pack)
368368

369+
def patch_all_shebang(self, to_movable=True, max_exe_size=999999):
370+
"""make all python launchers relatives"""
371+
import glob
372+
import os
373+
for ffname in glob.glob(r'%s\Scripts\*.exe' % self.target):
374+
size = os.path.getsize(ffname)
375+
if size <= max_exe_size:
376+
utils.patch_shebang_line(ffname, to_movable=to_movable)
377+
378+
369379
def install(self, package, install_options=None):
370380
"""Install package in distribution"""
371381
assert package.is_compatible_with(self)
@@ -407,9 +417,7 @@ def install(self, package, install_options=None):
407417
# touching pip at installation seems not working anymore
408418
# so brute force method is applied
409419
if package.name == "pip" or package.name == "get-pip" or 1 == 1:
410-
import glob
411-
for ffname in glob.glob(r'%s\Scripts\*.exe' % self.target):
412-
utils.patch_shebang_line(ffname)
420+
self.patch_all_shebang()
413421
# ensure pip.exe and easy_install.exe
414422
problems = [('pip', 'pip'), ('easy_install', 'easy_install-')]
415423
solutions = [('%s.%s' % sys.version_info[:2]),

0 commit comments

Comments
 (0)