From 969b8b24900c0030800401c33702135b6571f14f Mon Sep 17 00:00:00 2001 From: Jake Selig Date: Tue, 19 Mar 2024 13:25:06 -0700 Subject: [PATCH] chore: add script to patch during python only --- .github/workflows/release-python-grpc-web.yml | 6 + Cargo.lock | 220 +++++++++++++----- Cargo.toml | 3 - crates/python/scripts/patch_hyper_proxy.py | 21 ++ 4 files changed, 192 insertions(+), 58 deletions(-) create mode 100644 crates/python/scripts/patch_hyper_proxy.py diff --git a/.github/workflows/release-python-grpc-web.yml b/.github/workflows/release-python-grpc-web.yml index 5dba6a1d6..ac4e049e2 100644 --- a/.github/workflows/release-python-grpc-web.yml +++ b/.github/workflows/release-python-grpc-web.yml @@ -46,6 +46,8 @@ jobs: run: | pip install toml python scripts/patch_package_name.py + cd ../.. + python crates/python/scripts/patch_hyper_proxy.py - name: Build wheels - universal2 # universal2 supports both x86_64 and aarch64 uses: messense/maturin-action@v1 @@ -85,6 +87,8 @@ jobs: run: | pip install toml python scripts/patch_package_name.py + cd ../.. + python crates/python/scripts/patch_hyper_proxy.py - name: Build wheels uses: messense/maturin-action@v1 with: @@ -122,6 +126,8 @@ jobs: run: | pip install toml python scripts/patch_package_name.py + cd ../.. + python crates/python/scripts/patch_hyper_proxy.py - name: Build sdist uses: messense/maturin-action@v1 with: diff --git a/Cargo.lock b/Cargo.lock index 5af769e2c..9daa3f841 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -216,6 +216,12 @@ dependencies = [ "rustc-demangle", ] +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + [[package]] name = "base64" version = "0.21.7" @@ -254,9 +260,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "block-buffer" @@ -533,6 +539,15 @@ dependencies = [ "typenum", ] +[[package]] +name = "ct-logs" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1a816186fa68d9e426e3cb4ae4dff1fcd8e4a2c34b781bf7a822574a0d0aac8" +dependencies = [ + "sct 0.6.1", +] + [[package]] name = "darling" version = "0.14.4" @@ -675,7 +690,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c9720bba047d567ffc8a3cba48bf19126600e249ab7f128e9233e6376976a116" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "syn 1.0.109", @@ -928,7 +943,7 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06683b93020a07e3dbcf5f8c0f6d40080d725bea7936fc01ad345c01b97dc270" dependencies = [ - "base64", + "base64 0.21.7", "bytes", "headers-core", "http", @@ -952,6 +967,12 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -1057,22 +1078,40 @@ dependencies = [ [[package]] name = "hyper-proxy" -version = "0.9.0" -source = "git+https://github.com/hoodie/hyper-proxy?rev=49325f3#49325f36ef4b4bf4a8c8a82a9a7ab249606bf866" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca815a891b24fdfb243fa3239c86154392b0953ee584aa1a2a1f66d20cbe75cc" dependencies = [ "bytes", - "futures-util", + "futures", "headers", "http", "hyper", - "hyper-rustls", - "rustls-native-certs 0.6.3", + "hyper-rustls 0.22.1", + "rustls-native-certs 0.5.0", "tokio", - "tokio-rustls 0.24.1", + "tokio-rustls 0.22.0", "tower-service", "webpki", ] +[[package]] +name = "hyper-rustls" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f9f7a97316d44c0af9b0301e65010573a853a9fc97046d7331d7f6bc0fd5a64" +dependencies = [ + "ct-logs", + "futures-util", + "hyper", + "log", + "rustls 0.19.1", + "rustls-native-certs 0.5.0", + "tokio", + "tokio-rustls 0.22.0", + "webpki", +] + [[package]] name = "hyper-rustls" version = "0.24.2" @@ -1082,9 +1121,7 @@ dependencies = [ "futures-util", "http", "hyper", - "log", "rustls 0.21.10", - "rustls-native-certs 0.6.3", "tokio", "tokio-rustls 0.24.1", ] @@ -1250,10 +1287,10 @@ version = "9.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c7ea04a7c5c055c175f189b6dc6ba036fd62306b58c66c9f6389036c503a3f4" dependencies = [ - "base64", + "base64 0.21.7", "js-sys", "pem", - "ring", + "ring 0.17.8", "serde", "serde_json", "simple_asn1", @@ -1804,7 +1841,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1030c719b0ec2a2d25a5df729d6cff1acf3cc230bf766f4f97833591f7577b90" dependencies = [ - "base64", + "base64 0.21.7", "serde", ] @@ -1814,7 +1851,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2580e33f2292d34be285c5bc3dba5259542b083cfad6037b6d70345f24dcb735" dependencies = [ - "heck", + "heck 0.4.1", "itertools 0.11.0", "prost", "prost-types", @@ -1847,7 +1884,7 @@ version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b8fcc794035347fb64beda2d3b462595dd2753e3f268d89c5aae77e8cf2c310" dependencies = [ - "base64", + "base64 0.21.7", "serde", ] @@ -1959,7 +1996,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c55e02e35260070b6f716a2423c2ff1c3bb1642ddca6f99e1f26d06268a0e2d2" dependencies = [ "bytes", - "heck", + "heck 0.4.1", "itertools 0.11.0", "log", "multimap", @@ -2078,7 +2115,7 @@ version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c7e9b68bb9c3149c5b0cade5d07f953d6d125eb4337723c4ccdb665f1f96185" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "pyo3-build-config", "quote", @@ -2148,7 +2185,7 @@ dependencies = [ [[package]] name = "qcs-api-client-common" version = "0.7.12-rc.0" -source = "git+https://github.com/rigetti/qcs-api-client-rust?branch=grpc-web-hyper#226e7c13282b3375c793c1f5f0ee53b4b296702b" +source = "git+https://github.com/rigetti/qcs-api-client-rust?branch=grpc-web-hyper#e594d61f498c6f3e4d5cc5d60d3833f87b185a2e" dependencies = [ "async-trait", "backoff", @@ -2170,7 +2207,7 @@ dependencies = [ [[package]] name = "qcs-api-client-grpc" version = "0.7.14-rc.0" -source = "git+https://github.com/rigetti/qcs-api-client-rust?branch=grpc-web-hyper#226e7c13282b3375c793c1f5f0ee53b4b296702b" +source = "git+https://github.com/rigetti/qcs-api-client-rust?branch=grpc-web-hyper#e594d61f498c6f3e4d5cc5d60d3833f87b185a2e" dependencies = [ "backoff", "http", @@ -2202,7 +2239,7 @@ dependencies = [ [[package]] name = "qcs-api-client-openapi" version = "0.8.13-rc.0" -source = "git+https://github.com/rigetti/qcs-api-client-rust?branch=grpc-web-hyper#226e7c13282b3375c793c1f5f0ee53b4b296702b" +source = "git+https://github.com/rigetti/qcs-api-client-rust?branch=grpc-web-hyper#e594d61f498c6f3e4d5cc5d60d3833f87b185a2e" dependencies = [ "anyhow", "qcs-api-client-common", @@ -2374,11 +2411,11 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "reqwest" -version = "0.11.26" +version = "0.11.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78bf93c4af7a8bb7d879d51cebe797356ff10ae8516ace542b5182d9dcac10b2" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" dependencies = [ - "base64", + "base64 0.21.7", "bytes", "encoding_rs", "futures-core", @@ -2387,7 +2424,7 @@ dependencies = [ "http", "http-body", "hyper", - "hyper-rustls", + "hyper-rustls 0.24.2", "ipnet", "js-sys", "log", @@ -2461,6 +2498,21 @@ dependencies = [ "pyo3", ] +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin 0.5.2", + "untrusted 0.7.1", + "web-sys", + "winapi", +] + [[package]] name = "ring" version = "0.17.8" @@ -2471,8 +2523,8 @@ dependencies = [ "cfg-if 1.0.0", "getrandom", "libc", - "spin", - "untrusted", + "spin 0.9.8", + "untrusted 0.9.0", "windows-sys 0.52.0", ] @@ -2551,13 +2603,26 @@ version = "0.38.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "errno", "libc", "linux-raw-sys", "windows-sys 0.52.0", ] +[[package]] +name = "rustls" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" +dependencies = [ + "base64 0.13.1", + "log", + "ring 0.16.20", + "sct 0.6.1", + "webpki", +] + [[package]] name = "rustls" version = "0.21.10" @@ -2565,9 +2630,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ "log", - "ring", + "ring 0.17.8", "rustls-webpki 0.101.7", - "sct", + "sct 0.7.1", ] [[package]] @@ -2577,13 +2642,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e87c9956bd9807afa1f77e0f7594af32566e830e088a5576d27c5b6f30f49d41" dependencies = [ "log", - "ring", + "ring 0.17.8", "rustls-pki-types", "rustls-webpki 0.102.2", "subtle", "zeroize", ] +[[package]] +name = "rustls-native-certs" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a07b7c1885bd8ed3831c289b7870b13ef46fe0e856d288c30d9cc17d75a2092" +dependencies = [ + "openssl-probe", + "rustls 0.19.1", + "schannel", + "security-framework", +] + [[package]] name = "rustls-native-certs" version = "0.6.3" @@ -2615,7 +2692,7 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ - "base64", + "base64 0.21.7", ] [[package]] @@ -2624,7 +2701,7 @@ version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f48172685e6ff52a556baa527774f61fcaa884f59daf3375c62a3f1cd2549dab" dependencies = [ - "base64", + "base64 0.21.7", "rustls-pki-types", ] @@ -2640,8 +2717,8 @@ version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "ring", - "untrusted", + "ring 0.17.8", + "untrusted 0.9.0", ] [[package]] @@ -2650,9 +2727,9 @@ version = "0.102.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "faaa0a62740bedb9b2ef5afa303da42764c012f743917351dc9a237ea1663610" dependencies = [ - "ring", + "ring 0.17.8", "rustls-pki-types", - "untrusted", + "untrusted 0.9.0", ] [[package]] @@ -2697,14 +2774,24 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sct" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" +dependencies = [ + "ring 0.16.20", + "untrusted 0.7.1", +] + [[package]] name = "sct" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ - "ring", - "untrusted", + "ring 0.17.8", + "untrusted 0.9.0", ] [[package]] @@ -2870,6 +2957,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + [[package]] name = "spin" version = "0.9.8" @@ -2909,7 +3002,7 @@ version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6cf59daf282c0a494ba14fd21610a0325f9f90ec9d1231dea26bcb1d696c946" dependencies = [ - "heck", + "heck 0.4.1", "proc-macro2", "quote", "rustversion", @@ -2973,12 +3066,12 @@ dependencies = [ [[package]] name = "system-deps" -version = "6.2.1" +version = "6.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8e9199467bcbc77c6a13cc6e32a6af21721ab8c96aa0261856c4fda5a4433f0" +checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349" dependencies = [ "cfg-expr", - "heck", + "heck 0.5.0", "pkg-config", "toml 0.8.12", "version-compare", @@ -3177,6 +3270,17 @@ dependencies = [ "syn 2.0.53", ] +[[package]] +name = "tokio-rustls" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" +dependencies = [ + "rustls 0.19.1", + "tokio", + "webpki", +] + [[package]] name = "tokio-rustls" version = "0.24.1" @@ -3303,7 +3407,7 @@ dependencies = [ "async-stream", "async-trait", "axum", - "base64", + "base64 0.21.7", "bytes", "h2", "http", @@ -3344,7 +3448,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc3b0e1cedbf19fdfb78ef3d672cb9928e0a91a9cb4629cc0c916e8cff8aaaa1" dependencies = [ - "base64", + "base64 0.21.7", "bytes", "http", "http-body", @@ -3384,7 +3488,7 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "bytes", "futures-core", "futures-util", @@ -3586,6 +3690,12 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce" +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + [[package]] name = "untrusted" version = "0.9.0" @@ -3624,9 +3734,9 @@ dependencies = [ [[package]] name = "uuid" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" +checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" dependencies = [ "getrandom", ] @@ -3645,9 +3755,9 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "version-compare" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29" +checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" [[package]] name = "version_check" @@ -3787,12 +3897,12 @@ dependencies = [ [[package]] name = "webpki" -version = "0.22.4" +version = "0.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed63aea5ce73d0ff405984102c42de94fc55a6b75765d621c65262469b3c9b53" +checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" dependencies = [ - "ring", - "untrusted", + "ring 0.16.20", + "untrusted 0.7.1", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 74159c6b7..280680414 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,9 +2,6 @@ members = ["crates/*"] resolver = "2" -[patch.crates-io] -hyper-proxy = { git = "https://github.com/hoodie/hyper-proxy", rev = "49325f3" } - [workspace.dependencies] qcs-api = "0.2.1" qcs-api-client-common = { git = "https://github.com/rigetti/qcs-api-client-rust", branch = "grpc-web-hyper" } diff --git a/crates/python/scripts/patch_hyper_proxy.py b/crates/python/scripts/patch_hyper_proxy.py new file mode 100644 index 000000000..5559b6aa6 --- /dev/null +++ b/crates/python/scripts/patch_hyper_proxy.py @@ -0,0 +1,21 @@ +""" +Patch 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. +""" +import toml + +with open("Cargo.toml", "r+") as f: + data = toml.load(f) + data["patch"] = { + "crates-io": { + "hyper-proxy": { + "git": "https://github.com/hoodie/hyper-proxy", + "rev": "49325f3" + } + } + } + f.seek(0) + f.write(toml.dumps(data)) + f.truncate()