aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2019-03-03 00:04:03 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2019-03-03 00:04:03 +0000
commit4307e0cf49552229a0468c0618f8cc503822ccde (patch)
tree3d542e4d228c55df36d3fc438aa374b256d5e615
parent149f38d5fa07edd7a24b8bc33da9d98cada91d8d (diff)
parent1dc2143b13455b4ab0e2a0aa59dda791c0b0084f (diff)
downloadplatform_tools_external_updater-android10-mainline-a-release.tar.gz
platform_tools_external_updater-android10-mainline-a-release.tar.bz2
platform_tools_external_updater-android10-mainline-a-release.zip
Change-Id: Ide696752dd1cf90929f4d36f4d6a33c2e452634b
-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):