|
12 | 12 | # See the License for the specific language governing permissions and |
13 | 13 | # limitations under the License. |
14 | 14 |
|
15 | | -import re |
16 | 15 | import sys |
17 | 16 |
|
18 | 17 | import json |
@@ -129,64 +128,6 @@ def py_samples( |
129 | 128 | s.copy([result], excludes=excludes) |
130 | 129 |
|
131 | 130 |
|
132 | | -def configure_previous_major_version_branches() -> None: |
133 | | - """Configure releases from previous major version branches by editing |
134 | | - `.github/release-please.yml`. |
135 | | -
|
136 | | - The current library version is obtained from `version.py` in `google/**/version.py`, |
137 | | - or the `setup.py`. |
138 | | -
|
139 | | - Releases are configured for all previous major versions. For example, |
140 | | - if the library version is currently 3.5.1, the release-please config |
141 | | - will include v2, v1, and v0. |
142 | | - """ |
143 | | - |
144 | | - # In version.py: __version__ = "1.5.2" |
145 | | - # In setup.py: version = "1.5.2" |
146 | | - VERSION_REGEX = ( |
147 | | - r"(?:__)?version(?:__)?\s*=\s*[\"'](?P<major_version>\d)\.[\d\.]+[\"']" |
148 | | - ) |
149 | | - version_paths = list(Path(".").glob("google/**/version.py")) + [Path("setup.py")] |
150 | | - |
151 | | - major_version = None |
152 | | - |
153 | | - for p in version_paths: |
154 | | - match = re.search(VERSION_REGEX, Path(p).read_text()) |
155 | | - |
156 | | - if match is not None: |
157 | | - major_version = int(match.group("major_version")) |
158 | | - break |
159 | | - |
160 | | - if major_version is None: |
161 | | - raise RuntimeError( |
162 | | - "Unable to find library version in files {} with regex {}".format( |
163 | | - version_paths, VERSION_REGEX |
164 | | - ) |
165 | | - ) |
166 | | - |
167 | | - with open(".github/release-please.yml") as f: |
168 | | - release_please_yml = yaml.load(f, Loader=yaml.SafeLoader) |
169 | | - |
170 | | - if major_version > 0 and "branches" not in release_please_yml: |
171 | | - branches = [] |
172 | | - for version in range(major_version - 1, -1, -1): |
173 | | - branches.append( |
174 | | - { |
175 | | - "branch": f"v{version}", |
176 | | - "handleGHRelease": True, |
177 | | - "releaseType": "python", |
178 | | - } |
179 | | - ) |
180 | | - |
181 | | - with open(".github/release-please.yml", "a") as f: |
182 | | - # comments can't be expressed in PyYAML |
183 | | - f.write( |
184 | | - """# NOTE: this section is generated by synthtool.languages.python |
185 | | -# See https://github.com/googleapis/synthtool/blob/master/synthtool/languages/python.py\n""" |
186 | | - ) |
187 | | - f.write(yaml.dump({"branches": branches})) |
188 | | - |
189 | | - |
190 | 131 | def owlbot_main() -> None: |
191 | 132 | """Copies files from staging and template directories into current working dir. |
192 | 133 |
|
@@ -241,8 +182,6 @@ def owlbot_main() -> None: |
241 | 182 | for noxfile in Path(".").glob("**/noxfile.py"): |
242 | 183 | s.shell.run(["nox", "-s", "format"], cwd=noxfile.parent, hide_output=False) |
243 | 184 |
|
244 | | - configure_previous_major_version_branches() |
245 | | - |
246 | 185 |
|
247 | 186 | if __name__ == "__main__": |
248 | 187 | owlbot_main() |
0 commit comments