Skip to content

Commit

Permalink
Use conda-forge channeldata.json instead of conda search.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrclary committed Sep 29, 2023
1 parent a81d5f0 commit bf7b5fc
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions spyder/workers/updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,27 +95,16 @@ def get_releases(self):
if self.update_from_github:
# Get releases from GitHub
url = 'https://api.github.com/repos/spyder-ide/spyder/releases'
logger.debug(f"Getting releases from {url}.")
data = urlopen(url, **context).read()
else:
# Get releases from conda
logger.debug("Getting releases from conda-forge.")
if os.name == "nt":
platform = "win-64"
elif sys.platform == "darwin":
platform = "osx-64"
else:
platform = "linux-64"
cmd = f"{find_conda()} search "
cmd += f"'spyder[channel=conda-forge, subdir={platform}]'"
cmd += " --json"
proc = run_shell_command(cmd)
data, err = proc.communicate(timeout=20)
# Get releases from conda-forge
url = 'https://conda.anaconda.org/conda-forge/channeldata.json'
logger.debug(f"Getting releases from {url}.")
data = urlopen(url, **context).read()
except URLError as exc:
logger.debug(exc)
self.error = _('Unable to connect to the internet. <br><br>Make '
'sure the connection is working properly.')
except (HTTPError, TimeoutError, Exception) as exc:
except (HTTPError, Exception) as exc:
logger.debug(exc)
self.error = _('Unable to retrieve Spyder version information.')

Expand All @@ -132,7 +121,7 @@ def get_releases(self):
releases = set(item['tag_name'].replace('v', '')
for item in data)
else:
releases = set(v['version'] for v in data['spyder'])
releases = [data['packages']['spyder']['version']]

# Always reset self.releases
self.releases = sorted(releases)
Expand Down

0 comments on commit bf7b5fc

Please sign in to comment.