Skip to content
This repository was archived by the owner on Mar 31, 2026. It is now read-only.

Commit b828408

Browse files
committed
wip
1 parent d390d4d commit b828408

File tree

1 file changed

+14
-73
lines changed

1 file changed

+14
-73
lines changed

.librarian/generator-input/owlbot.py

Lines changed: 14 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -25,58 +25,9 @@
2525

2626
common = gcp.CommonTemplates()
2727

28-
29-
def get_staging_dirs(
30-
# This is a customized version of the s.get_staging_dirs() function
31-
# from synthtool to # cater for copying 3 different folders from
32-
# googleapis-gen:
33-
# spanner, spanner/admin/instance and spanner/admin/database.
34-
# Source:
35-
# https://github.com/googleapis/synthtool/blob/master/synthtool/transforms.py#L280
36-
default_version: Optional[str] = None,
37-
sub_directory: Optional[str] = None,
38-
) -> List[Path]:
39-
"""Returns the list of directories, one per version, copied from
40-
https://github.com/googleapis/googleapis-gen. Will return in lexical sorting
41-
order with the exception of the default_version which will be last (if specified).
42-
43-
Args:
44-
default_version (str): the default version of the API. The directory for this version
45-
will be the last item in the returned list if specified.
46-
sub_directory (str): if a `sub_directory` is provided, only the directories within the
47-
specified `sub_directory` will be returned.
48-
49-
Returns: the empty list if no file were copied.
50-
"""
51-
52-
staging = Path("owl-bot-staging")
53-
54-
if sub_directory:
55-
staging /= sub_directory
56-
57-
if staging.is_dir():
58-
# Collect the subdirectories of the staging directory.
59-
versions = [v.name for v in staging.iterdir() if v.is_dir()]
60-
# Reorder the versions so the default version always comes last.
61-
versions = [v for v in versions if v != default_version]
62-
versions.sort()
63-
if default_version is not None:
64-
versions += [default_version]
65-
dirs = [staging / v for v in versions]
66-
for dir in dirs:
67-
s._tracked_paths.add(dir)
68-
return dirs
69-
else:
70-
return []
71-
72-
73-
spanner_default_version = "v1"
74-
spanner_admin_instance_default_version = "v1"
75-
spanner_admin_database_default_version = "v1"
76-
7728
clean_up_generated_samples = True
7829

79-
for library in get_staging_dirs("v1"):
30+
for library in "v1":
8031
if clean_up_generated_samples:
8132
shutil.rmtree("samples/generated_samples", ignore_errors=True)
8233
clean_up_generated_samples = False
@@ -202,22 +153,7 @@ def get_staging_dirs(
202153
if count < 1:
203154
raise Exception("Expected replacements for gRPC channel options not made.")
204155

205-
s.move(
206-
library,
207-
excludes=[
208-
"google/cloud/spanner/**",
209-
"*.*",
210-
"noxfile.py",
211-
"docs/index.rst",
212-
"google/cloud/spanner_v1/__init__.py",
213-
"**/gapic_version.py",
214-
"testing/constraints-3.7.txt",
215-
],
216-
)
217156

218-
for library in get_staging_dirs(
219-
spanner_admin_instance_default_version, "spanner_admin_instance"
220-
):
221157
count = s.replace(
222158
[
223159
library / "google/cloud/spanner_admin_instance_v1/services/*/transports/grpc*",
@@ -233,14 +169,7 @@ def get_staging_dirs(
233169
)
234170
if count < 1:
235171
raise Exception("Expected replacements for gRPC channel options not made.")
236-
s.move(
237-
library,
238-
excludes=["google/cloud/spanner_admin_instance/**", "*.*", "docs/index.rst", "noxfile.py", "**/gapic_version.py", "testing/constraints-3.7.txt",],
239-
)
240172

241-
for library in get_staging_dirs(
242-
spanner_admin_database_default_version, "spanner_admin_database"
243-
):
244173
count = s.replace(
245174
[
246175
library / "google/cloud/spanner_admin_database_v1/services/*/transports/grpc*",
@@ -256,11 +185,23 @@ def get_staging_dirs(
256185
)
257186
if count < 1:
258187
raise Exception("Expected replacements for gRPC channel options not made.")
188+
259189
s.move(
260190
library,
261-
excludes=["google/cloud/spanner_admin_database/**", "*.*", "docs/index.rst", "noxfile.py", "**/gapic_version.py", "testing/constraints-3.7.txt",],
191+
excludes=[
192+
"google/cloud/spanner/**",
193+
"google/cloud/spanner_admin_instance/**"
194+
"google/cloud/spanner_admin_database/**"
195+
"*.*",
196+
"noxfile.py",
197+
"docs/index.rst",
198+
"google/cloud/spanner_v1/__init__.py",
199+
"**/gapic_version.py",
200+
"testing/constraints-3.7.txt",
201+
],
262202
)
263203

204+
264205
s.remove_staging_dirs()
265206

266207
# ----------------------------------------------------------------------------

0 commit comments

Comments
 (0)