File tree Expand file tree Collapse file tree 2 files changed +18
-19
lines changed Expand file tree Collapse file tree 2 files changed +18
-19
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ edition = "2021"
55description = " Pyth Lazer Publisher SDK types."
66license = " Apache-2.0"
77repository = " https://github.com/pyth-network/pyth-crosschain"
8- build = " build.rs"
98
109[dependencies ]
1110protobuf = " 3.7.2"
Original file line number Diff line number Diff line change @@ -15,24 +15,24 @@ echo "deleting build.rs file"
1515rm -f " ${PACKAGE_DIR} /build.rs"
1616
1717echo " updating lib.rs to export local protobuf files"
18- cat > " ${PACKAGE_DIR} /src/lib.rs " << EOF
19- pub mod transaction {
20- pub use crate::protobuf::pyth_lazer_transaction::*;
21- }
22- pub mod publisher_update {
23- pub use crate::protobuf::publisher_update::*;
24- }
25- mod protobuf;
26- EOF
27-
28- echo " removing build spec from Cargo.toml "
29- # MacOS sed command is slightly different
30- # This script shouldn't be run locally anyway, but I may as well make sure it works
31- if [[ " $OSTYPE " == " darwin " * ]] ; then
32- sed -i ' ' ' /build.*build\.rs/d ' Cargo.toml
33- else
34- sed -i ' /build.*build\.rs/d ' Cargo.toml
35- fi
18+ python3 -c "
19+ import re
20+
21+ def replace_mod_protobuf(file_path):
22+ with open(file_path, 'r') as f:
23+ content = f.read()
24+
25+ pattern = re.compile(r'mod\s+ protobuf\s*\{.*?\}', re.DOTALL)
26+
27+ replacement = 'mod protobuf;'
28+
29+ new_content = pattern.sub(replacement, content)
30+
31+ with open(file_path, 'w') as f:
32+ f.write(new_content)
33+
34+ replace_mod_protobuf(' ${PACKAGE_DIR} /src/lib.rs')
35+ "
3636
3737echo " publishing package"
3838cargo publish --token ${CARGO_REGISTRY_TOKEN}
You can’t perform that action at this time.
0 commit comments