2525
2626common = 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-
7728clean_up_generated_samples = True
7829
79- for library in get_staging_dirs (spanner_default_version , "spanner " ):
30+ for library in s . get_staging_dirs ("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,6 @@ 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- )
217-
218- for library in get_staging_dirs (
219- spanner_admin_instance_default_version , "spanner_admin_instance"
220- ):
221156 count = s .replace (
222157 [
223158 library / "google/cloud/spanner_admin_instance_v1/services/*/transports/grpc*" ,
@@ -233,14 +168,7 @@ def get_staging_dirs(
233168 )
234169 if count < 1 :
235170 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- )
240171
241- for library in get_staging_dirs (
242- spanner_admin_database_default_version , "spanner_admin_database"
243- ):
244172 count = s .replace (
245173 [
246174 library / "google/cloud/spanner_admin_database_v1/services/*/transports/grpc*" ,
@@ -258,7 +186,16 @@ def get_staging_dirs(
258186 raise Exception ("Expected replacements for gRPC channel options not made." )
259187 s .move (
260188 library ,
261- excludes = ["google/cloud/spanner_admin_database/**" , "*.*" , "docs/index.rst" , "noxfile.py" , "**/gapic_version.py" , "testing/constraints-3.7.txt" ,],
189+ excludes = [
190+ "google/cloud/spanner/**" ,
191+ "*.*" ,
192+ "noxfile.py" ,
193+ "docs/index.rst" ,
194+ "google/cloud/spanner_v1/__init__.py" ,
195+ "testing/constraints-3.7.txt" ,
196+ "google/cloud/spanner_admin_instance/**" ,
197+ "google/cloud/spanner_admin_database/**"
198+ ],
262199 )
263200
264201s .remove_staging_dirs ()
@@ -278,27 +215,12 @@ def get_staging_dirs(
278215 templated_files ,
279216 excludes = [
280217 ".coveragerc" ,
281- ".github/workflows" , # exclude gh actions as credentials are needed for tests
218+ ".github/**" ,
219+ ".kokoro/**" ,
282220 "README.rst" ,
283- ".github/release-please.yml" ,
284- ".kokoro/test-samples-impl.sh" ,
285- ".kokoro/presubmit/presubmit.cfg" ,
286- ".kokoro/samples/python3.7/**" ,
287- ".kokoro/samples/python3.8/**" ,
288221 ],
289222)
290223
291- # Ensure CI runs on a new instance each time
292- s .replace (
293- ".kokoro/build.sh" ,
294- "# Setup project id." ,
295- """\
296- # Set up creating a new instance for each system test run
297- export GOOGLE_CLOUD_TESTS_CREATE_SPANNER_INSTANCE=true
298-
299- # Setup project id.""" ,
300- )
301-
302224# Update samples folder in CONTRIBUTING.rst
303225s .replace ("CONTRIBUTING.rst" , "samples/snippets" , "samples/samples" )
304226
@@ -321,4 +243,4 @@ def get_staging_dirs(
321243
322244# Use a python runtime which is available in the owlbot post processor here
323245# https://github.com/googleapis/synthtool/blob/master/docker/owlbot/python/Dockerfile
324- s .shell .run (["nox" , "-s" , "blacken-3.10 " ], hide_output = False )
246+ s .shell .run (["nox" , "-s" , "blacken-3.14 " ], hide_output = False )
0 commit comments