Skip to content
Snippets Groups Projects
Commit 2c8e18ec authored by Haibo Huang's avatar Haibo Huang Committed by android-build-merger
Browse files

Support version splitter other than dot

am: f1602666

Change-Id: I34ed1f69f47bf1830db5af6f9f059169d137a902
parents 1017d69b f1602666
No related branches found
No related tags found
No related merge requests found
...@@ -57,11 +57,12 @@ def replace_package(source_dir, target_dir): ...@@ -57,11 +57,12 @@ def replace_package(source_dir, target_dir):
'update_package.sh') 'update_package.sh')
subprocess.check_call(['bash', script_path, source_dir, target_dir]) subprocess.check_call(['bash', script_path, source_dir, target_dir])
VERSION_SPLITTER_PATTERN = r'[\.\-_]'
VERSION_PATTERN = (r'^(?P<prefix>[^\d]*)' + VERSION_PATTERN = (r'^(?P<prefix>[^\d]*)' +
r'(?P<version>\d+(\.\d+)*)' + r'(?P<version>\d+(' + VERSION_SPLITTER_PATTERN + r'\d+)*)' +
r'(?P<suffix>.*)$') r'(?P<suffix>.*)$')
VERSION_RE = re.compile(VERSION_PATTERN) VERSION_RE = re.compile(VERSION_PATTERN)
VERSION_SPLITTER_RE = re.compile(VERSION_SPLITTER_PATTERN)
def _parse_version(version): def _parse_version(version):
...@@ -82,7 +83,7 @@ def _match_and_get_version(prefix, suffix, version): ...@@ -82,7 +83,7 @@ def _match_and_get_version(prefix, suffix, version):
right_format = (version_prefix == prefix and version_suffix == suffix) 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): def get_latest_version(current_version, version_list):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment