• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2020 Google LLC
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15"""This script is used to synthesize generated parts of this library."""
16
17import synthtool as s
18from synthtool import gcp
19from synthtool.languages import python
20
21common = gcp.CommonTemplates()
22
23# ----------------------------------------------------------------------------
24# Add templated files
25# ----------------------------------------------------------------------------
26excludes = [
27    "noxfile.py",  # pytype
28    "setup.cfg",  # pytype
29    ".flake8",  # flake8-import-order, layout
30    ".coveragerc",  # layout
31    "CONTRIBUTING.rst",  # no systests
32    ".github/workflows/unittest.yml",  # exclude unittest gh action
33    ".github/workflows/lint.yml",  # exclude lint gh action
34    "README.rst",
35]
36templated_files = common.py_library(microgenerator=True, cov_level=100)
37s.move(templated_files, excludes=excludes)
38
39# Add pytype support
40s.replace(
41    ".gitignore",
42    """\
43.pytest_cache
44""",
45    """\
46.pytest_cache
47.pytype
48""",
49)
50
51python.configure_previous_major_version_branches()
52
53s.shell.run(["nox", "-s", "blacken"], hide_output=False)
54