Skip to content

Commit 572bb4e

Browse files
committed
example strings for every regex usage
1 parent 14fe2aa commit 572bb4e

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

scripts/update_android_ios_dependencies.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def get_files(dirs_and_files, file_extension, file_name=None,
157157
return files
158158

159159
# Regex to match versions with just digits (ignoring things like -alpha, -beta)
160-
NON_EXPERIMENTAL_VERSION_RE = re.compile('[0-9.]+$')
160+
RE_NON_EXPERIMENTAL_VERSION = re.compile('[0-9.]+$')
161161

162162
########## iOS pods versions update #######################################
163163

@@ -221,7 +221,7 @@ def get_pod_versions(specs_repo, pods=PODS, ignore_pods=None,
221221
parent_dir = os.path.dirname(podspec_file)
222222
version = os.path.basename(parent_dir)
223223
if not allow_experimental and '-cppsdk' not in version:
224-
if not re.match(NON_EXPERIMENTAL_VERSION_RE, version):
224+
if not re.match(RE_NON_EXPERIMENTAL_VERSION, version):
225225
continue
226226
all_versions[podname].append(version)
227227

@@ -357,14 +357,16 @@ def modify_pod_file(pod_file, pod_version_map, dryrun=True):
357357
print()
358358

359359

360+
# Regex to match lines like:
361+
# | | Firebase/Auth Cocoapod (8.2.0)
360362
RE_README_POD_VERSION = re.compile(
361363
r"\|(?P<spaces>\s+)\| (?P<pod_name>.*) Cocoapod \((?P<version>([0-9.]+))\)")
362364

363365
def modify_readme_file_pods(readme_filepath, version_map, dryrun=True):
364366
"""Modify a readme Markdown file to reference correct cocoapods versions.
365367
366368
Looks for lines like:
367-
<br>Firebase/AdMob Cocoapod (7.11.0)<br>Firebase/Auth Cocoapod (8.1.0)
369+
| | Firebase/Auth Cocoapod (8.2.0)
368370
for pods matching the ones in the version map, and modifies them in-place.
369371
370372
Args:
@@ -463,7 +465,7 @@ def get_latest_maven_versions(ignore_packages=None, allow_experimental=False):
463465
versions = group_child.attrib['versions'].split(',')
464466
if not allow_experimental:
465467
versions = [version for version in versions
466-
if re.match(NON_EXPERIMENTAL_VERSION_RE, version) or '-cppsdk' in version]
468+
if re.match(RE_NON_EXPERIMENTAL_VERSION, version) or '-cppsdk' in version]
467469
if versions:
468470
latest_valid_version = versions[-1]
469471
latest_versions[package_full_name] = latest_valid_version
@@ -533,6 +535,9 @@ def replace_dependency(m):
533535
print()
534536

535537

538+
# Regex to match lines like:
539+
# | | com.google.firebase:firebase-auth:1.2.3
540+
# | | com.google.firebase:firebase-auth:1.2.3-alpha
536541
RE_README_ANDROID_VERSION = re.compile(
537542
r"\|(?P<spaces>\s+)\| (?P<pkg>[a-zA-Z0-9._-]+:[a-zA-Z0-9._-]+):([a-zA-Z0-9._-]+)")
538543

@@ -541,7 +546,7 @@ def modify_readme_file_android(readme_filepath, version_map, dryrun=True):
541546
"""Modify a readme Markdown file to reference correct module versions.
542547
543548
Looks for lines like:
544-
<br>com.google.firebase:firebase-core:15.0.0<br>
549+
| | com.google.firebase:firebase-auth:1.2.3
545550
for modules matching the ones in the version map, and modifies them in-place.
546551
547552
Args:
@@ -595,6 +600,7 @@ def replace_module_line(m):
595600

596601
# Regex to match lines like:
597602
# implementation 'com.google.firebase:firebase-auth:1.2.3'
603+
# implementation 'com.google.firebase:firebase-auth:1.2.3-alpha'
598604
RE_GRADLE_COMPILE_MODULE = re.compile(
599605
r"implementation\s*\'(?P<pkg>[a-zA-Z0-9._-]+:[a-zA-Z0-9._-]+):([a-zA-Z0-9._-]+)\'")
600606

0 commit comments

Comments
 (0)