Skip to content

Commit ba04bb7

Browse files
committed
chore: add timeout to run nox session
1 parent 80de21c commit ba04bb7

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

.generator/cli.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,7 @@ def _run_individual_session(nox_session: str, library_id: str, repo: str):
929929
"-f",
930930
f"{repo}/packages/{library_id}/noxfile.py",
931931
]
932-
result = subprocess.run(command, text=True, check=True)
932+
result = subprocess.run(command, text=True, check=True, timeout=1200)
933933
logger.info(result)
934934

935935

@@ -1199,8 +1199,7 @@ def _update_version_for_library(
11991199

12001200
# Find and update version.py or gapic_version.py files
12011201
search_base = Path(f"{repo}/{path_to_library}")
1202-
version_files = []
1203-
patterns = ["**/gapic_version.py", "**/version.py"]
1202+
version_files = list(search_base.rglob("**/gapic_version.py"))
12041203
excluded_dirs = {
12051204
".nox",
12061205
".venv",
@@ -1210,16 +1209,14 @@ def _update_version_for_library(
12101209
"build",
12111210
"dist",
12121211
"__pycache__",
1213-
"tests",
12141212
}
1215-
for pattern in patterns:
1216-
version_files.extend(
1217-
[
1218-
p
1219-
for p in search_base.rglob(pattern)
1220-
if not any(part in excluded_dirs for part in p.parts)
1221-
]
1222-
)
1213+
version_files.extend(
1214+
[
1215+
p
1216+
for p in search_base.rglob("**/version.py")
1217+
if not any(part in excluded_dirs for part in p.parts)
1218+
]
1219+
)
12231220

12241221
if not version_files:
12251222
# Fallback to `pyproject.toml`` or `setup.py``. Proto-only libraries have
@@ -1241,8 +1238,8 @@ def _update_version_for_library(
12411238
_write_text_file(output_path, updated_content)
12421239

12431240
# Find and update snippet_metadata.json files
1244-
snippet_metadata_files = Path(f"{repo}/{path_to_library}/samples").rglob(
1245-
"**/*snippet*.json"
1241+
snippet_metadata_files = Path(f"{repo}/{path_to_library}").rglob(
1242+
"samples/**/*snippet*.json"
12461243
)
12471244
for metadata_file in snippet_metadata_files:
12481245
output_path = f"{output}/{metadata_file.relative_to(repo)}"

0 commit comments

Comments
 (0)