Skip to content

Commit 3558571

Browse files
committed
regex according to restored readme format
1 parent ee84478 commit 3558571

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

scripts/update_ios_android_dependencies.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ def modify_pod_file(pod_file, pod_version_map, dryrun=True):
290290

291291

292292
RE_README_POD_VERSION = re.compile(
293-
r"| (?P<pod_name>.*) Cocoapod \((?P<version>([0-9.]+))\)")
293+
r"\|(?P<spaces>\s+)\| (?P<pod_name>.*) Cocoapod \((?P<version>([0-9.]+))\)")
294294

295295
def modify_readme_file_pods(readme_filepath, version_map, dryrun=True):
296296
"""Modify a readme Markdown file to reference correct cocoapods versions.
@@ -323,8 +323,9 @@ def replace_pod_line(m):
323323
pod_key = m.group('pod_name').replace('/', '')
324324
if pod_key not in version_map:
325325
return m.group(0)
326-
repl = '| %s Cocoapod (%s)' % (m.group('product_pod_name'),
327-
version_map[pod_key])
326+
repl = '|%s| %s Cocoapod (%s)' % (m.group('spaces'),
327+
m.group('pod_name'),
328+
version_map[pod_key])
328329
return repl
329330

330331
substituted_pairs = []
@@ -438,7 +439,7 @@ def replace_dependency(m):
438439

439440

440441
RE_README_ANDROID_VERSION = re.compile(
441-
r"| (?P<pkg>[a-zA-Z0-9._-]+:[a-zA-Z0-9._-]+):([0-9.]+)")
442+
r"\|(?P<spaces>\s+)\| (?P<pkg>[a-zA-Z0-9._-]+:[a-zA-Z0-9._-]+):([0-9.]+)")
442443

443444

444445
def modify_readme_file_android(readme_filepath, version_map, dryrun=True):
@@ -473,7 +474,7 @@ def replace_module_line(m):
473474
pkg = m.group('pkg').replace('-', '_').replace(':', '.')
474475
if pkg not in version_map:
475476
return m.group(0)
476-
repl = '| %s:%s ' % (m.group('pkg'), version_map[pkg])
477+
repl = '|%s| %s:%s ' % (m.group('spaces'), m.group('pkg'), version_map[pkg])
477478
return repl
478479

479480
substituted_pairs = []
@@ -559,7 +560,6 @@ def main():
559560

560561
if not args.skip_android:
561562
latest_android_versions_map = get_latest_maven_versions()
562-
563563
dep_files = get_files(args.depfiles, file_extension='.gradle',
564564
file_name='firebase_dependencies.gradle')
565565
for dep_file in dep_files:
@@ -568,6 +568,5 @@ def main():
568568
for readme_file in readme_files:
569569
modify_readme_file_android(readme_file, latest_android_versions_map, args.dryrun)
570570

571-
572571
if __name__ == '__main__':
573572
main()

0 commit comments

Comments
 (0)