-
Notifications
You must be signed in to change notification settings - Fork 559
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add a tool to update internal dependencies (#1321)
Before this change the updates to the dependencies would happen very seldomly, with this script, I propose we do it before each minor version release. Adding a shell script and adding a reminder to the release process may help with that.
- Loading branch information
Showing
13 changed files
with
595 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
build==0.9 | ||
click==8.0.1 | ||
colorama | ||
importlib_metadata==1.4.0 | ||
installer | ||
more_itertools==8.13.0 | ||
packaging==22.0 | ||
pep517 | ||
pip==22.3.1 | ||
pip_tools==6.12.1 | ||
setuptools==60.10 | ||
tomli | ||
wheel==0.38.4 | ||
zipp==1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Copyright 2017 The Bazel Authors. All rights reserved. | ||
# | ||
# 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. | ||
load("//python:py_binary.bzl", "py_binary") | ||
load("//python:py_library.bzl", "py_library") | ||
load("//python:py_test.bzl", "py_test") | ||
|
||
licenses(["notice"]) | ||
|
||
py_library( | ||
name = "args", | ||
srcs = ["args.py"], | ||
imports = ["../../.."], | ||
deps = ["//python/runfiles"], | ||
) | ||
|
||
py_library( | ||
name = "update_file", | ||
srcs = ["update_file.py"], | ||
imports = ["../../.."], | ||
) | ||
|
||
py_binary( | ||
name = "update_coverage_deps", | ||
srcs = ["update_coverage_deps.py"], | ||
data = [ | ||
"//python/private:coverage_deps", | ||
], | ||
env = { | ||
"UPDATE_FILE": "$(rlocationpath //python/private:coverage_deps)", | ||
}, | ||
imports = ["../../.."], | ||
deps = [ | ||
":args", | ||
":update_file", | ||
], | ||
) | ||
|
||
py_binary( | ||
name = "update_pip_deps", | ||
srcs = ["update_pip_deps.py"], | ||
data = [ | ||
"//:MODULE.bazel", | ||
"//python/pip_install:repositories", | ||
"//python/pip_install:requirements_txt", | ||
], | ||
env = { | ||
"MODULE_BAZEL": "$(rlocationpath //:MODULE.bazel)", | ||
"REPOSITORIES_BZL": "$(rlocationpath //python/pip_install:repositories)", | ||
"REQUIREMENTS_TXT": "$(rlocationpath //python/pip_install:requirements_txt)", | ||
}, | ||
imports = ["../../.."], | ||
deps = [ | ||
":args", | ||
":update_file", | ||
], | ||
) | ||
|
||
py_test( | ||
name = "update_file_test", | ||
srcs = ["update_file_test.py"], | ||
imports = ["../../.."], | ||
deps = [ | ||
":update_file", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Copyright 2023 The Bazel Authors. All rights reserved. | ||
# | ||
# 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. | ||
|
||
"""A small library for common arguments when updating files.""" | ||
|
||
import pathlib | ||
|
||
from python.runfiles import runfiles | ||
|
||
|
||
def path_from_runfiles(input: str) -> pathlib.Path: | ||
"""A helper to create a path from runfiles. | ||
Args: | ||
input: the string input to construct a path. | ||
Returns: | ||
the pathlib.Path path to a file which is verified to exist. | ||
""" | ||
path = pathlib.Path(runfiles.Create().Rlocation(input)) | ||
if not path.exists(): | ||
raise ValueError(f"Path '{path}' does not exist") | ||
|
||
return path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.