-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: simplify grpc-web package renaming script
- Loading branch information
1 parent
1d1b7a7
commit f6119a1
Showing
5 changed files
with
41 additions
and
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
""" | ||
Appends grpc-web to the project name of both Cargo.toml and pyproject.toml, | ||
and patches the `hyper-proxy` dependency. | ||
This is used in CI to update the package metadata before publishing the alternate | ||
package with the grpc-web feature enabled. | ||
""" | ||
|
||
from io import TextIOWrapper | ||
from os.path import dirname, realpath, relpath, join | ||
import toml | ||
|
||
pycrate_path = dirname(dirname(realpath(__file__))) | ||
workspace_path = dirname(dirname(pycrate_path)) | ||
|
||
|
||
def write(f: TextIOWrapper, data): | ||
f.seek(0) | ||
f.write(toml.dumps(data)) | ||
f.truncate() | ||
|
||
|
||
# Update the package metadata | ||
|
||
with open(join(pycrate_path, "pyproject.toml"), "r+") as f: | ||
data = toml.load(f) | ||
data["project"]["name"] = "qcs-sdk-python-grpc-web" | ||
write(f, data) | ||
|
||
with open(join(pycrate_path, "Cargo.toml"), "r+") as f: | ||
data = toml.load(f) | ||
data["package"]["name"] = "qcs-sdk-python-grpc-web" | ||
write(f, data) | ||
|
||
# Patch the `hyper-proxy` dependency | ||
|
||
with open(join(workspace_path, "Cargo.toml"), "r+") as f: | ||
data = toml.load(f) | ||
data["patch"] = {"crates-io": {"hyper-proxy": {"git": "https://github.com/rigetti/hyper-proxy"}}} | ||
write(f, data) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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