This repository was archived by the owner on Feb 26, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathowlbot.py
More file actions
97 lines (83 loc) · 3.06 KB
/
owlbot.py
File metadata and controls
97 lines (83 loc) · 3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""This script is used to synthesize generated parts of this library."""
import synthtool as s
from synthtool import gcp
from synthtool.languages import python
common = gcp.CommonTemplates()
default_version = "v2"
for library in s.get_staging_dirs(default_version):
if library.name == "v2":
# Fix generated unit tests
s.replace(
library / "tests/unit/gapic/logging_v2/test_logging_service_v2.py",
"MonitoredResource\(\s*type_",
"MonitoredResource(type"
)
s.move(
library,
excludes=[
"setup.py",
"README.rst",
"google/cloud/logging/__init__.py", # generated types are hidden from users
"google/cloud/logging_v2/__init__.py",
"docs/index.rst",
"docs/logging_v2", # Don't include gapic library docs. Users should use the hand-written layer instead
"scripts/fixup_logging_v2_keywords.py", # don't include script since it only works for generated layer
],
)
s.remove_staging_dirs()
# ----------------------------------------------------------------------------
# Add templated files
# ----------------------------------------------------------------------------
templated_files = common.py_library(
unit_cov_level=95,
cov_level=99,
microgenerator=True,
system_test_external_dependencies=[
"google-cloud-bigquery",
"google-cloud-pubsub",
"google-cloud-storage",
"google-cloud-testutils",
],
unit_test_external_dependencies=["flask", "webob", "django"],
samples=True,
)
s.move(templated_files, excludes=[".coveragerc", "docs/multiprocessing.rst"])
# adjust .trampolinerc for environment tests
s.replace(
".trampolinerc",
"required_envvars[^\)]*\)",
"required_envvars+=()"
)
s.replace(
".trampolinerc",
"pass_down_envvars\+\=\(",
'pass_down_envvars+=(\n "ENVIRONMENT"\n "RUNTIME"'
)
# don't lint environment tests
s.replace(
".flake8",
"exclude =",
'exclude =\n # Exclude environment test code.\n tests/environment/**\n'
)
# --------------------------------------------------------------------------
# Samples templates
# --------------------------------------------------------------------------
python.py_samples()
# --------------------------------------------------------------------------
# Samples templates
# --------------------------------------------------------------------------
python.py_samples()
s.shell.run(["nox", "-s", "blacken"], hide_output=False)