Skip to content

Commit 2815f55

Browse files
committed
update version check
1 parent 11d2f82 commit 2815f55

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@
2626
entry_points={
2727
"console_scripts": ["submit50=submit50.__main__:main"]
2828
},
29-
version="3.2.0",
29+
version="3.2.1",
3030
include_package_data=True
3131
)

submit50/__main__.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def check_announcements():
6060
raise Error(res.text.strip())
6161

6262

63-
def check_version(package_name=__package__, timeout=15):
63+
def check_version(package_name=__package__, timeout=30):
6464
"""Check that submit50 is the latest version according to submit50.io."""
6565
if not __version__:
6666
return
@@ -69,7 +69,7 @@ def check_version(package_name=__package__, timeout=15):
6969
res = requests.get(f"{SUBMIT_URL}/versions/submit50", timeout=timeout)
7070
if res.status_code != 200:
7171
raise Error(_("Could not connect to submit.cs50.io."
72-
"Please visit our status page https://cs50.statuspage.io for more information."))
72+
"Please visit our status page https://cs50.statuspage.io for more information."))
7373

7474
# Get submit.cs50.io version
7575
latest_io = version.parse(res.text.strip())
@@ -84,15 +84,11 @@ def check_version(package_name=__package__, timeout=15):
8484

8585
# Check for minimum requirement
8686
if current < latest_io:
87-
pass
87+
raise Error(_(f"v{current} of {package_name} is no longer supported. Run pip3 install --upgrade {package_name} to upgrade."))
8888

8989
# Check for latest version
9090
if latest_pypi > current or latest_io > current:
91-
raise Error(_(f"A newer version of {package_name} is available. Run pip3 install --upgrade {package_name} to upgrade."))
92-
93-
# Resolve if submit.cs50.io version differs from PyPi
94-
if latest_pypi != latest_io:
95-
pass
91+
cprint(f"A newer version of {package_name} is available. Run pip3 install --upgrade {package_name} to upgrade.", "magenta")
9692

9793

9894
def setup_logging(level):

0 commit comments

Comments
 (0)