diff options
author | Lukas Fleischer <lfleischer@calcurse.org> | 2016-01-25 21:02:30 +0100 |
---|---|---|
committer | Lukas Fleischer <lfleischer@calcurse.org> | 2016-01-25 21:02:30 +0100 |
commit | 4fff8ae4fe2615c7d966c4b2f73b2a4dbf9c6abf (patch) | |
tree | 89a304dc08c2b6f0f12e581a633df7ea75d00c1f /contrib/caldav | |
parent | 1a45713d1d5f369d57ed1461697baedc8d7a0135 (diff) | |
download | calcurse-4fff8ae4fe2615c7d966c4b2f73b2a4dbf9c6abf.tar.gz calcurse-4fff8ae4fe2615c7d966c4b2f73b2a4dbf9c6abf.zip |
calcurse-caldav: Improve version check
Make sure that at least a current Git build of calcurse is used.
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'contrib/caldav')
-rwxr-xr-x | contrib/caldav/calcurse-caldav.py | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/contrib/caldav/calcurse-caldav.py b/contrib/caldav/calcurse-caldav.py index eb85459..e02a905 100755 --- a/contrib/caldav/calcurse-caldav.py +++ b/contrib/caldav/calcurse-caldav.py @@ -6,6 +6,7 @@ import configparser import hashlib import http.client import os +import re import ssl import subprocess import sys @@ -63,16 +64,11 @@ def calcurse_remove(objhash): def calcurse_version(): p = subprocess.Popen([calcurse, '--version'], stdout=subprocess.PIPE) - tokens = p.communicate()[0].decode('utf-8').rstrip().split(" ") - - if len(tokens) < 2: - return None - if tokens[0] != 'Calcurse': - return None - tokens = tokens[1].split(".") - if len(tokens) < 2: + m = re.match('Calcurse ([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9]+)-)?', + p.communicate()[0].decode('utf-8')) + if not m: return None - return int(tokens[0]) * 10 + int(tokens[1]) + return tuple(map(int, m.groups(0))) def get_auth_headers(): if not username or not password: @@ -397,8 +393,8 @@ ver = calcurse_version() if ver is None: die('Invalid calcurse binary. Make sure that the file specified in ' + 'the configuration is a valid and up-to-date calcurse binary.') -elif ver < 40: - die('Incompatible calcurse binary detected. Version >=4.0.0 is required ' + +elif ver < (4, 0, 0, 73): + die('Incompatible calcurse binary detected. Version >=4.1.0 is required ' + 'to synchronize with CalDAV servers.') # Create lock file. |