Skip to content

Commit

Permalink
Add support for spec compatible URLs in server generated code and upd…
Browse files Browse the repository at this point in the history
…ate to protoc 3.12.4.
  • Loading branch information
ofpiyush committed Aug 24, 2020
1 parent 987a500 commit 21ccd0c
Show file tree
Hide file tree
Showing 27 changed files with 281 additions and 111 deletions.
25 changes: 18 additions & 7 deletions clientcompat/pycompat/clientcompat_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions clientcompat/pycompat/pycompat.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ def main():
client = clientcompat_pb2_twirp.CompatServiceClient(req.service_address)
try:
resp = do_request(client, req)
sys.stdout.write(resp.SerializeToString())
sys.stdout.write(resp.SerializeToString().decode(encoding="utf-8"))
except clientcompat_pb2_twirp.TwirpException as e:
sys.stderr.write(e.code)


def read_request():
input_str = sys.stdin.read()
return clientcompat_pb2.ClientCompatMessage.FromString(input_str)
return clientcompat_pb2.ClientCompatMessage.FromString(input_str.encode(encoding="utf-8"))


def do_request(client, req):
Expand Down
13 changes: 9 additions & 4 deletions example/service_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions install_proto.bash
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ PROTOC_EXISTS=$?
if [ $PROTOC_EXISTS -eq 0 ]; then
echo "Protoc already installed"
PROTOC_VERSION=`protoc --version`
if [ "$PROTOC_VERSION" == "libprotoc 3.11.0" ]; then
if [ "$PROTOC_VERSION" == "libprotoc 3.12.4" ]; then
exit 0
fi
echo "libprotoc 3.11.0 required, but found: $PROTOC_VERSION"
echo "libprotoc 3.12.4 required, but found: $PROTOC_VERSION"
exit 1
fi

Expand All @@ -30,8 +30,8 @@ if [ "$(uname)" == "Darwin" ]; then
elif [ `whoami` == "root" ]; then
mkdir -p /usr/local/src/protoc
pushd /usr/local/src/protoc
wget https://github.com/google/protobuf/releases/download/v3.11.0/protoc-3.11.0-linux-x86_64.zip -O /usr/local/src/protoc-3.11.0-linux-x86_64.zip
unzip -x ../protoc-3.11.0-linux-x86_64.zip
wget https://github.com/google/protobuf/releases/download/v3.12.4/protoc-3.12.4-linux-x86_64.zip -O /usr/local/src/protoc-3.12.4-linux-x86_64.zip
unzip -x ../protoc-3.12.4-linux-x86_64.zip
if [ ! -e /usr/local/bin/protoc ]; then
ln -s `pwd`/bin/protoc /usr/local/bin/protoc
fi
Expand All @@ -41,8 +41,8 @@ elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
sudo chmod a+w /usr/local/src
mkdir -p /usr/local/src/protoc
pushd /usr/local/src/protoc
wget https://github.com/google/protobuf/releases/download/v3.11.0/protoc-3.11.0-linux-x86_64.zip -O /usr/local/src/protoc-3.11.0-linux-x86_64.zip
unzip -x ../protoc-3.11.0-linux-x86_64.zip
wget https://github.com/google/protobuf/releases/download/v3.12.4/protoc-3.12.4-linux-x86_64.zip -O /usr/local/src/protoc-3.12.4-linux-x86_64.zip
unzip -x ../protoc-3.12.4-linux-x86_64.zip
if [ ! -e /usr/local/bin/protoc ]; then
sudo ln -s `pwd`/bin/protoc /usr/local/bin/protoc
fi
Expand Down
2 changes: 2 additions & 0 deletions internal/twirptest/empty_service/empty_service_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions internal/twirptest/google_protobuf_imports/service_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions internal/twirptest/importable/importable_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions internal/twirptest/importer/importer_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions internal/twirptest/importer_local/importer_local_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 21ccd0c

Please sign in to comment.