Skip to content

Commit

Permalink
Add owlbot replacements to persist changes
Browse files Browse the repository at this point in the history
  • Loading branch information
plamut committed Aug 25, 2021
1 parent 7c9119c commit 162e2f0
Showing 1 changed file with 64 additions and 11 deletions.
75 changes: 64 additions & 11 deletions owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,58 @@
s.replace(
library / f"google/cloud/bigquery_{library.name}/types/standard_sql.py",
r"type_ ",
"type "
"type ",
)

# Remove the replacements below once
# https://github.com/googleapis/synthtool/pull/1188 is merged

# Update googleapis/repo-automation-bots repo to main in .kokoro/*.sh files
s.replace(
".kokoro/*.sh",
"repo-automation-bots/tree/master",
"repo-automation-bots/tree/main",
)

# Customize CONTRIBUTING.rst to replace master with main
s.replace(
"CONTRIBUTING.rst",
"fetch and merge changes from upstream into master",
"fetch and merge changes from upstream into main",
)

s.replace(
"CONTRIBUTING.rst", "git merge upstream/master", "git merge upstream/main",
)

s.replace(
"CONTRIBUTING.rst",
"""export GOOGLE_CLOUD_TESTING_BRANCH=\"master\"""",
"""export GOOGLE_CLOUD_TESTING_BRANCH=\"main\"""",
)

s.replace(
"CONTRIBUTING.rst", r"remote \(``master``\)", "remote (``main``)",
)

s.replace(
"CONTRIBUTING.rst",
"blob/master/CONTRIBUTING.rst",
"blob/main/CONTRIBUTING.rst",
)

s.replace(
"CONTRIBUTING.rst", "blob/master/noxfile.py", "blob/main/noxfile.py",
)

s.replace(
"docs/conf.py", "master_doc", "root_doc",
)

s.replace(
"docs/conf.py",
"# The master toctree document.",
"# The root toctree document.",
)

s.move(
Expand All @@ -78,8 +129,8 @@
"noxfile.py",
"setup.py",
f"scripts/fixup_bigquery_{library.name}_keywords.py",
f"google/cloud/bigquery/__init__.py",
f"google/cloud/bigquery/py.typed",
"google/cloud/bigquery/__init__.py",
"google/cloud/bigquery/py.typed",
# There are no public API endpoints for the generated ModelServiceClient,
# thus there's no point in generating it and its tests.
f"google/cloud/bigquery_{library.name}/services/**",
Expand All @@ -98,9 +149,9 @@
microgenerator=True,
split_system_tests=True,
intersphinx_dependencies={
"pandas": 'http://pandas.pydata.org/pandas-docs/dev',
"pandas": "http://pandas.pydata.org/pandas-docs/dev",
"geopandas": "https://geopandas.org/",
}
},
)

# BigQuery has a custom multiprocessing note
Expand All @@ -113,7 +164,7 @@
# Include custom SNIPPETS_TESTS job for performance.
# https://github.com/googleapis/python-bigquery/issues/191
".kokoro/presubmit/presubmit.cfg",
]
],
)

# ----------------------------------------------------------------------------
Expand All @@ -125,28 +176,29 @@
s.replace(
"docs/conf.py",
r'\{"members": True\}',
'{"members": True, "inherited-members": True}'
'{"members": True, "inherited-members": True}',
)

# Tell Sphinx to ingore autogenerated docs files.
s.replace(
"docs/conf.py",
r'"samples/snippets/README\.rst",',
'\g<0>\n "bigquery_v2/services.rst", # generated by the code generator',
'\\g<0>\n "bigquery_v2/services.rst", # generated by the code generator',
)

# ----------------------------------------------------------------------------
# pytype-related changes
# ----------------------------------------------------------------------------

# Add .pytype to .gitignore
s.replace(".gitignore", r"\.pytest_cache", "\g<0>\n.pytype")
s.replace(".gitignore", r"\.pytest_cache", "\\g<0>\n.pytype")

# Add pytype config to setup.cfg
s.replace(
"setup.cfg",
r"universal = 1",
textwrap.dedent(""" \g<0>
textwrap.dedent(
""" \\g<0>
[pytype]
python_version = 3.8
Expand All @@ -160,7 +212,8 @@
# There's some issue with finding some pyi files, thus disabling.
# The issue https://github.com/google/pytype/issues/150 is closed, but the
# error still occurs for some reason.
pyi-error""")
pyi-error"""
),
)

s.shell.run(["nox", "-s", "blacken"], hide_output=False)

0 comments on commit 162e2f0

Please sign in to comment.