Provide easy flag for disabling update check.

Change-Id: I63939c304e9c1c634bf12c7ca6109b19926d26a1
This commit is contained in:
Monty Taylor 2012-01-27 15:43:44 -05:00
parent 284871b691
commit e8529608fd

View File

@ -35,6 +35,7 @@ version = "1.12"
VERBOSE = False
UPDATE = False
CONFIGDIR = os.path.expanduser("~/.config/git-review")
GLOBAL_CONFIG = "/etc/git-review/git-review.conf"
PYPI_URL = "http://pypi.python.org/pypi/git-review/json"
PYPI_CACHE_TIME = 60 * 60 * 24 # 24 hours
@ -83,6 +84,14 @@ def update_latest_version(version_file_path):
def latest_is_newer():
""" Check if there is a new version of git-review. """
# Skip version check if distro package turns it off
if os.path.exists(GLOBAL_CONFIG):
config = dict(check=False)
configParser = ConfigParser.ConfigParser(config)
configParser.read(GLOBAL_CONFIG)
if not configParser.getboolean("updates", "check"):
return False
version_file_path = os.path.join(CONFIGDIR, "latest-version")
update_latest_version(version_file_path)