Following v1.11.0, here's the corrected calibre-update.sh:
calibre-debug -c "import urllib as u; from calibre.constants import numeric_version; raise SystemExit(int(numeric_version < (tuple(map(int, u.urlopen('http://calibre-ebook.com/downloads/latest_version').read().split('.'))))))"
if [ $UP_TO_DATE = 0 ]; then
echo "Calibre is up-to-date"
sudo python -c "import sys; py3 = sys.version_info > 2; u = __import__('urllib.request' if py3 else 'urllib', fromlist=1); exec(u.urlopen('http://status.calibre-ebook.com/linux_installer').read()); main(install_dir='/opt')"
With Kovid's one-liner for the check, the separate calibre-check.py file is now unnecessary.
Should I go back in my previous posts and remove the obsolete versions? I usually hate to delete code when there's no version control (yeah, even little snippets like those; code is code), but I don't really know if there's a policy here regarding code obsolescence.