8000 chore: migrate to standard owlbot.py (#270) · googleapis/google-cloud-python@b02191c · GitHub
[go: up one dir, main page]

Skip to content

Commit b02191c

Browse files
authored
chore: migrate to standard owlbot.py (#270)
* chore: remove pb2 file generation during post processing * fix: remove obsolete proto files * chore: migrate to standard owlbot.py
1 parent 4dc815b commit b02191c

File tree

1 file changed

+34
-17
lines changed

1 file changed

+34
-17
lines changed

packages/googleapis-common-protos/owlbot.py

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,46 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
15+
import json
16+
from pathlib import Path
17+
import shutil
18+
1419
import synthtool as s
1520
import synthtool.gcp as gcp
1621
from synthtool.languages import python
1722

23+
# ----------------------------------------------------------------------------
24+
# Copy the generated client from the owl-bot staging directory
25+
# ----------------------------------------------------------------------------
26+
27+
clean_up_generated_samples = True
1828

19-
for library in s.get_staging_dirs():
20-
s.move([library / "**/*.py*"])
29+
# Load the default version defined in .repo-metadata.json.
30+
default_version = json.load(open(".repo-metadata.json", "rt")).get(
31+
"default_version"
32+
)
33+
34+
for library in s.get_staging_dirs(default_version):
35+
if clean_up_generated_samples:
36+
shutil.rmtree("samples/generated_samples", ignore_errors=True)
37+
clean_up_generated_samples = False
38+
s.move([library], excludes=["**/gapic_version.py"])
2139
s.remove_staging_dirs()
2240

2341
# ----------------------------------------------------------------------------
24-
# Add templated files
42+
# Add templated files
2543
# ----------------------------------------------------------------------------
26-
common = gcp.CommonTemplates()
27-
templated_files = common.py_library()
28-
# TODO: use protoc-docs-plugin to add docstrings to protos
29-
s.move(templated_files / ".kokoro", excludes=["docs/**/*", "publish-docs.sh"])
30-
s.move(templated_files / "setup.cfg")
31-
s.move(templated_files / "LICENSE")
32-
s.move(templated_files / "MANIFEST.in")
33-
s.move(templated_files / "renovate.json")
34-
s.move(templated_files / ".github", excludes=["workflows"])
35-
36-
s.shell.run(["nox", "-s", "blacken"], hide_output=False)
37-
38-
# Add license headers
39-
python.fix_pb2_headers()
44+
45+
templated_files = gcp.CommonTemplates().py_library(
46+
cov_level=100,
47+
microgenerator=True,
48+
versions=gcp.common.detect_versions(path="./google", default_first=True),
49+
)
50+
s.move(templated_files, excludes=[".coveragerc", ".github/release-please.yml"])
51+
52+
python.py_samples(skip_readmes=True)
53+
54+
# run format session for all directories which have a noxfile
55+
for noxfile in Path(".").glob("**/noxfile.py"):
56+
s.shell.run(["nox", "-s", "format"], cwd=noxfile.parent, hide_output=False)

0 commit comments

Comments
 (0)
0