Provide easy flag for disabling update check.
Change-Id: I63939c304e9c1c634bf12c7ca6109b19926d26a1
This commit is contained in:
@@ -35,6 +35,7 @@ version = "1.12"
|
|||||||
VERBOSE = False
|
VERBOSE = False
|
||||||
UPDATE = False
|
UPDATE = False
|
||||||
CONFIGDIR = os.path.expanduser("~/.config/git-review")
|
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_URL = "http://pypi.python.org/pypi/git-review/json"
|
||||||
PYPI_CACHE_TIME = 60 * 60 * 24 # 24 hours
|
PYPI_CACHE_TIME = 60 * 60 * 24 # 24 hours
|
||||||
|
|
||||||
@@ -83,6 +84,14 @@ def update_latest_version(version_file_path):
|
|||||||
def latest_is_newer():
|
def latest_is_newer():
|
||||||
""" Check if there is a new version of git-review. """
|
""" 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")
|
version_file_path = os.path.join(CONFIGDIR, "latest-version")
|
||||||
update_latest_version(version_file_path)
|
update_latest_version(version_file_path)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user