Skip to content

Commit

Permalink
Merge pull request #21784 from mrclary/artifact-name
Browse files Browse the repository at this point in the history
PR: Do not use version in macOS artifact name and fix names for the future Spyder 6 installers (Installers)
  • Loading branch information
ccordoba12 authored Feb 21, 2024
2 parents 75e5b60 + ed98ee7 commit 1880ff0
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 19 deletions.
5 changes: 3 additions & 2 deletions installers/macOS/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import shutil
from logging import getLogger, StreamHandler, Formatter
from pathlib import Path
import platform
from setuptools import setup
from platform import machine

from spyder import get_versions

Expand Down Expand Up @@ -103,7 +103,8 @@ def disk_image_name(make_lite=False):
"""
Return disk image name
"""
dmg_name = f'Spyder-{SPYVER}_{machine()}'
mach = "_arm64" if "ARM64" in platform.version() else ""
dmg_name = f'Spyder{mach}'
if make_lite:
dmg_name += '-Lite'
dmg_name += '.dmg'
Expand Down
24 changes: 15 additions & 9 deletions spyder/plugins/application/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,21 @@ def setup(self):

# Attributes
self.dialog_manager = DialogManager()
self.application_update_status = None
if is_pynsist() or running_in_mac_app():
self.application_update_status = ApplicationUpdateStatus(
parent=self)
(self.application_update_status.sig_check_for_updates_requested
.connect(self.check_updates))
(self.application_update_status.sig_install_on_close_requested
.connect(self.set_installer_path))
self.application_update_status.set_no_status()

self.application_update_status = ApplicationUpdateStatus(
parent=self
)

# Users can only use this widget in our apps.
if not is_pynsist() and not running_in_mac_app():
self.application_update_status.hide()

(self.application_update_status.sig_check_for_updates_requested
.connect(self.check_updates))
(self.application_update_status.sig_install_on_close_requested
.connect(self.set_installer_path))
self.application_update_status.set_no_status()

self.give_updates_feedback = False
self.thread_updates = None
self.worker_updates = None
Expand Down
40 changes: 32 additions & 8 deletions spyder/workers/updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
import logging
import os
import os.path as osp
import platform
import tempfile
import traceback

# Third party imports
from packaging.version import parse
from qtpy.QtCore import QObject, Signal
import requests
from requests.exceptions import ConnectionError, HTTPError, SSLError
Expand Down Expand Up @@ -225,16 +227,38 @@ def _progress_reporter(self, block_number, read_size, total_size):
def _download_installer(self):
"""Donwload latest Spyder standalone installer executable."""
tmpdir = tempfile.gettempdir()
is_full_installer = (is_module_installed('numpy') or
is_module_installed('pandas'))
if os.name == 'nt':
name = 'Spyder_64bit_{}.exe'.format('full' if is_full_installer
else 'lite')

# If running on macOS under Rosetta, platform.machine will not be
# correct so check for ARM64 in version instead. All other
# platforms will be x86_64.
mach = "arm64" if "ARM64" in platform.version() else "x86_64"

if parse(self.latest_release_version) > parse("5"):
# conda-based installer name
if os.name == 'nt':
plat, ext = 'Windows', 'exe'
elif platform.system == 'Darwin':
plat, ext = 'macOS', 'pkg'
else:
plat, ext = 'Linux', 'sh'
name = f'Spyder-{plat}-{mach}.{ext}'
else:
name = 'Spyder{}.dmg'.format('' if is_full_installer else '-Lite')
# 5.x installer name
is_full_installer = (is_module_installed('numpy') or
is_module_installed('pandas'))
if os.name == 'nt':
name = 'Spyder_64bit_{}.exe'.format(
'full' if is_full_installer else 'lite'
)
else:
name = 'Spyder{}{}.dmg'.format(
f'_{mach}' if mach == 'arm64' else '',
'' if is_full_installer else '-Lite'
)

url = ('https://github.com/spyder-ide/spyder/releases/download/'
f'v{self.latest_release_version}/{name}')

url = ('https://github.com/spyder-ide/spyder/releases/latest/'
f'download/{name}')
dir_path = osp.join(tmpdir, 'spyder', 'updates')
os.makedirs(dir_path, exist_ok=True)
installer_dir_path = osp.join(
Expand Down

0 comments on commit 1880ff0

Please sign in to comment.