aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaibo Huang <hhb@google.com>2019-02-28 17:13:50 -0800
committerandroid-build-merger <android-build-merger@google.com>2019-02-28 17:13:50 -0800
commit1dc2143b13455b4ab0e2a0aa59dda791c0b0084f (patch)
tree3d542e4d228c55df36d3fc438aa374b256d5e615
parent9659052609714c9af4a097897077ed3ef78ef05a (diff)
parent13c4983cc991f8c14da20843eb7fdf47869631aa (diff)
downloadexternal_updater-android10-qpr2-s3-release.tar.gz
am: 13c4983cc9 Change-Id: I3f49f33648ab8db3d36a824bfce09ff3d05f4137
-rw-r--r--updater_utils.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/updater_utils.py b/updater_utils.py
index 54ddf98..a08846c 100644
--- a/updater_utils.py
+++ b/updater_utils.py
@@ -57,11 +57,12 @@ def replace_package(source_dir, target_dir):
'update_package.sh')
subprocess.check_call(['bash', script_path, source_dir, target_dir])
-
+VERSION_SPLITTER_PATTERN = r'[\.\-_]'
VERSION_PATTERN = (r'^(?P<prefix>[^\d]*)' +
- r'(?P<version>\d+(\.\d+)*)' +
+ r'(?P<version>\d+(' + VERSION_SPLITTER_PATTERN + r'\d+)*)' +
r'(?P<suffix>.*)$')
VERSION_RE = re.compile(VERSION_PATTERN)
+VERSION_SPLITTER_RE = re.compile(VERSION_SPLITTER_PATTERN)
def _parse_version(version):
@@ -82,7 +83,7 @@ def _match_and_get_version(prefix, suffix, version):
right_format = (version_prefix == prefix and version_suffix == suffix)
- return [right_format] + [int(v) for v in version.split('.')]
+ return [right_format] + [int(v) for v in VERSION_SPLITTER_RE.split(version)]
def get_latest_version(current_version, version_list):