Skip to content

Commit

Permalink
Replace sed hack with 2to3. (#709)
Browse files Browse the repository at this point in the history
  • Loading branch information
vibss2397 committed Jun 18, 2020
1 parent eb50cde commit 30b1135
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ci/build_sphinx_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ python -m grpc_tools.protoc -I=proto/ --python_out=pycue/opencue/compiled_proto

# Fix imports to work in both Python 2 and 3. See
# <https://github.com/protocolbuffers/protobuf/issues/1491> for more info.
sed -i 's/^\(import.*_pb2\)/from . \1/' pycue/opencue/compiled_proto/*.py
2to3 -wn -f import pycue/opencue/compiled_proto/*_pb2*.py

# Build the docs and treat warnings as errors
~/.local/bin/sphinx-build -W -b html -d docs/_build/doctrees docs docs/_build/html
3 changes: 2 additions & 1 deletion ci/run_python_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ python -m grpc_tools.protoc -I=proto/ --python_out=rqd/rqd/compiled_proto --grpc

# Fix imports to work in both Python 2 and 3. See
# <https://github.com/protocolbuffers/protobuf/issues/1491> for more info.
sed -i 's/^\(import.*_pb2\)/from . \1/' pycue/opencue/compiled_proto/*.py rqd/rqd/compiled_proto/*.py
2to3 -wn -f import pycue/opencue/compiled_proto/*_pb2*.py
2to3 -wn -f import rqd/rqd/compiled_proto/*_pb2*.py

python pycue/setup.py test
PYTHONPATH=pycue python pyoutline/setup.py test
Expand Down
2 changes: 1 addition & 1 deletion cueadmin/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ RUN python -m grpc_tools.protoc \

# Fix imports to work in both Python 2 and 3. See
# <https://github.com/protocolbuffers/protobuf/issues/1491> for more info.
RUN sed -i 's/^\(import.*_pb2\)/from . \1/' pycue/opencue/compiled_proto/*.py
RUN 2to3 -wn -f import pycue/opencue/compiled_proto/*_pb2*.py

COPY cueadmin/README.md ./cueadmin/
COPY cueadmin/setup.py ./cueadmin/
Expand Down
2 changes: 1 addition & 1 deletion cuegui/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ RUN python -m grpc_tools.protoc \

# Fix imports to work in both Python 2 and 3. See
# <https://github.com/protocolbuffers/protobuf/issues/1491> for more info.
RUN sed -i 's/^\(import.*_pb2\)/from . \1/' pycue/opencue/compiled_proto/*.py
RUN 2to3 -wn -f import pycue/opencue/compiled_proto/*_pb2*.py

COPY cuegui/README.md ./cuegui/
COPY cuegui/setup.py ./cuegui/
Expand Down
2 changes: 1 addition & 1 deletion cuesubmit/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ RUN python -m grpc_tools.protoc \

# Fix imports to work in both Python 2 and 3. See
# <https://github.com/protocolbuffers/protobuf/issues/1491> for more info.
RUN sed -i 's/^\(import.*_pb2\)/from . \1/' pycue/opencue/compiled_proto/*.py
RUN 2to3 -wn -f import pycue/opencue/compiled_proto/*_pb2*.py

COPY pyoutline/README.md ./pyoutline/
COPY pyoutline/setup.py ./pyoutline/
Expand Down
2 changes: 1 addition & 1 deletion pycue/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ RUN python -m grpc_tools.protoc \

# Fix imports to work in both Python 2 and 3. See
# <https://github.com/protocolbuffers/protobuf/issues/1491> for more info.
RUN sed -i 's/^\(import.*_pb2\)/from . \1/' pycue/opencue/compiled_proto/*.py
RUN 2to3 -wn -f import pycue/opencue/compiled_proto/*_pb2*.py

# TODO(bcipriano) Lint the code here. (Issue #78)

Expand Down
2 changes: 1 addition & 1 deletion pyoutline/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ RUN python -m grpc_tools.protoc \

# Fix imports to work in both Python 2 and 3. See
# <https://github.com/protocolbuffers/protobuf/issues/1491> for more info.
RUN sed -i 's/^\(import.*_pb2\)/from . \1/' pycue/opencue/compiled_proto/*.py
RUN 2to3 -wn -f import pycue/opencue/compiled_proto/*_pb2*.py

COPY pyoutline/README.md ./pyoutline/
COPY pyoutline/setup.py ./pyoutline/
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
2to3==1.0
enum34==1.1.6
future==0.17.1
futures==3.2.0;python_version<"3.0"
Expand Down
2 changes: 1 addition & 1 deletion rqd/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ RUN python3.6 -m grpc_tools.protoc \

# Fix imports to work in both Python 2 and 3. See
# <https://github.com/protocolbuffers/protobuf/issues/1491> for more info.
RUN sed -i 's/^\(import.*_pb2\)/from . \1/' rqd/rqd/compiled_proto/*.py
RUN 2to3 -wn -f import rqd/rqd/compiled_proto/*_pb2*.py

# TODO(bcipriano) Lint the code here. (Issue #78)

Expand Down

0 comments on commit 30b1135

Please sign in to comment.