Skip to content

Commit

Permalink
Merge pull request MystenLabs#264 from MystenLabs/update-move-depende…
Browse files Browse the repository at this point in the history
…ncy-script

Update move dependency script
  • Loading branch information
lxfind authored Jan 25, 2022
2 parents 49ab2a0 + 14da889 commit 9bb9af6
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions scripts/move_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

ROOT = os.path.join(os.path.dirname(__file__), "../")
PATTERN = re.compile(
'(\s*)(.+) = { git = "https://github.com/.+/move", (?:rev|branch)=".+" }(\s*)'
'(\s*)(.+) = { git = "https://github.com/.+/move", (?:rev|branch)=".+"(,.*)? }(\s*)'
)


Expand Down Expand Up @@ -67,10 +67,11 @@ def process_line(line, depth):
if m:
prefix = m.group(1)
name = m.group(2)
postfix = m.group(3)
extra = "" if m.group(3) is None else m.group(3)
postfix = m.group(4)
go_back = "".join(["../"] * (depth + 1))
return '{}{} = {{ path = "{}move/language/{}" }}{}'.format(
prefix, name, go_back, path_map.get(name, name), postfix
return '{}{} = {{ path = "{}move/language/{}"{} }}{}'.format(
prefix, name, go_back, path_map.get(name, name), extra, postfix
)
return line

Expand All @@ -84,11 +85,13 @@ def process_line(line, _):
if m:
prefix = m.group(1)
name = m.group(2)
postfix = m.group(3)
return '{}{} = {{ git = "https://github.com/{}/move", {}="{}" }}{}'.format(
extra = "" if m.group(3) is None else m.group(3)
postfix = m.group(4)
return '{}{} = {{ git = "https://github.com/{}/move", {}="{}"{} }}{}'.format(
prefix, name, repo,
"branch" if branch else "rev",
branch if branch else rev,
extra,
postfix
)
return line
Expand Down

0 comments on commit 9bb9af6

Please sign in to comment.