Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions cli50/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@

import argparse
import gettext
import json
import os
import re
import requests
import shutil
import subprocess
import tzlocal
import urllib.error
import urllib.request

from importlib.resources import files
from packaging import version
Expand Down Expand Up @@ -59,9 +61,11 @@ def main():
# Check PyPI for newer version
if __version__ and not args["fast"]:
try:
release = max(requests.get("https://pypi.org/pypi/cli50/json").json()["releases"], key=version.parse)
assert release <= __version__
except requests.RequestException:
with urllib.request.urlopen("https://pypi.org/pypi/cli50/json", timeout=10) as response:
releases = json.load(response)["releases"]
release = max(releases, key=version.parse)
assert version.parse(release) <= version.parse(__version__)
except (KeyError, OSError, ValueError):
pass
except AssertionError:
try:
Expand Down Expand Up @@ -170,7 +174,6 @@ def main():
if not args["fast"]:

# Remote manifest
import json
try:
RemoteManifest = json.loads(subprocess.check_output([
"docker", "manifest", "inspect", f"{IMAGE}:{args['tag']}", "--verbose"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"console_scripts": ["cli50=cli50.__main__:main"]
},
url="https://github.com/cs50/cli50",
version="8.0.1",
version="8.0.2",
include_package_data=True
)
Loading