Skip to content

Commit a20d9fd

Browse files
author
stonebig
committed
adapt wppm for pip requirements
1 parent e44fbfa commit a20d9fd

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

winpython/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -580,15 +580,15 @@ def do_script(this_script, python_exe=None, copy_to=None,
580580
"""Execute a script (get-pip typically)"""
581581
if python_exe is None:
582582
python_exe = sys.executable
583-
assert osp.isfile(python_exe)
584583
myroot = os.path.dirname(python_exe)
585584

586585
# cmd = [python_exe, myroot + r'\Scripts\pip-script.py', 'install']
587586
cmd = [python_exe]
588587
if install_options:
589588
cmd += install_options # typically ['--no-deps']
590589
print('script install_options', install_options)
591-
cmd += [this_script]
590+
if this_script:
591+
cmd += [this_script]
592592
# print('build_wheel', myroot, cmd)
593593
print("Executing ", cmd)
594594

winpython/wppm.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,32 @@ def install(self, package, install_options=None):
412412
if tmp_fname is not None:
413413
os.remove(tmp_fname)
414414

415+
def do_pip_action(self, actions=None, install_options=None):
416+
"""Do pip action in a distribution"""
417+
my_list = install_options
418+
if my_list is None:
419+
my_list = []
420+
my_actions = actions
421+
if my_actions is None:
422+
my_actions = []
423+
executing = osp.join(self.target, '..', 'scripts', 'env.bat')
424+
if osp.isfile(executing):
425+
complement = [r'&&' , 'cd' , '/D', self.target,
426+
r'&&', osp.join(self.target, 'python.exe') ]
427+
complement += [ '-m', 'pip']
428+
else:
429+
executing = osp.join(self.target, 'python.exe')
430+
complement = [ '-m', 'pip']
431+
try:
432+
fname = utils.do_script(this_script=None,
433+
python_exe=executing,
434+
architecture=self.architecture, verbose=self.verbose,
435+
install_options=complement + my_actions + my_list)
436+
except RuntimeError:
437+
if not self.verbose:
438+
print("Failed!")
439+
raise
440+
415441
def patch_standard_packages(self, package_name=''):
416442
"""patch Winpython packages in need"""
417443
import filecmp

0 commit comments

Comments
 (0)