Skip to content

Commit

Permalink
Copy install.[sh|bat] script to temporary location. This is required …
Browse files Browse the repository at this point in the history
…for Windows, otherwise adverse behavior occurs when executing a file that is being over-written. Copy for macOS and Linux too, just to be safe.
  • Loading branch information
mrclary committed Apr 16, 2024
1 parent 48ff669 commit 61efbc4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions spyder/plugins/updatemanager/widgets/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import os
import os.path as osp
import platform
import shutil
import subprocess
import sys

Expand Down Expand Up @@ -414,11 +415,14 @@ def start_install(self):
"""Install from downloaded installer or update through conda."""

# Install script
script = osp.abspath(__file__ + '/../../scripts/install.' +
('bat' if os.name == 'nt' else 'sh'))
# Copy to temp location to be safe
script_name = 'install.' + ('bat' if os.name == 'nt' else 'sh')
script_path = osp.abspath(__file__ + '/../../scripts/' + script_name)
tmpscript_path = osp.join(get_temp_dir(), script_name)
shutil.copy2(script_path, tmpscript_path)

# Sub command
sub_cmd = [script, '-p', sys.prefix]
sub_cmd = [tmpscript_path, '-p', sys.prefix]
if osp.exists(self.installer_path):
# Run downloaded installer
sub_cmd.extend(['-i', self.installer_path])
Expand Down

0 comments on commit 61efbc4

Please sign in to comment.