That's indeed a lot leaner, especially since numeric_version is already a tuple, so version comparison is pretty straightforward.
Thanks Kovid!
Code:
#!/usr/bin/env python
## -*- coding: utf-8 -*-
if sys.version_info[0] > 2:
import urllib.request as u
else:
import urllib as u
from calibre.constants import numeric_version
if numeric_version < tuple(map(int, u.urlopen('http://calibre-ebook.com/downloads/latest_version').read()[:-1].split("."))):
sys.exit(0)
else:
sys.exit(1)
EDIT: newer version of update code
here