-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Python 2 support.
- Loading branch information
Jason
authored
Nov 11, 2020
1 parent
813e52f
commit 1fc1ef5
Showing
7 changed files
with
74 additions
and
28 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
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 |
---|---|---|
@@ -1,27 +1,36 @@ | ||
#!/bin/bash -e | ||
|
||
# Build embag for various version of Python | ||
for version in cp35-cp35m \ | ||
cp36-cp36m \ | ||
cp37-cp37m \ | ||
cp38-cp38 \ | ||
cp39-cp39 | ||
do | ||
# Link the correct version of python | ||
ln -sf /opt/python/$version/bin/python /usr/bin/python3 | ||
# Build embag libs and echo test binary | ||
(cd /tmp/embag && \ | ||
PYTHON_BIN_PATH=/opt/python/$version/bin/python bazel build //python:libembag.so //embag_echo:embag_echo && \ | ||
bazel test test:* --test_output=all) | ||
function build() { | ||
PYTHON_PATH=$1 | ||
PYTHON_VERSION=$2 | ||
|
||
# Build embag libs and echo test binary | ||
(cd /tmp/embag && | ||
PYTHON_BIN_PATH="$PYTHON_PATH/python" bazel build //python:libembag.so //embag_echo:embag_echo && | ||
PYTHON_BIN_PATH="$PYTHON_PATH/python" bazel test //test:embag_test "//test:embag_test_python$PYTHON_VERSION" --cache_test_results=no --test_output=all) | ||
|
||
# Build wheel | ||
cp /tmp/embag/bazel-bin/python/libembag.so /tmp/pip_build/embag | ||
(cd /tmp/pip_build && "$PYTHON_PATH/python" setup.py bdist_wheel && | ||
auditwheel repair /tmp/pip_build/dist/embag*.whl --plat manylinux2014_x86_64 && | ||
"$PYTHON_PATH/pip" install wheelhouse/embag*.whl && | ||
"$PYTHON_PATH/python" -c 'import embag; embag.View(); print("Successfully loaded embag!")' && | ||
cp wheelhouse/* /tmp/out && | ||
rm wheelhouse/* && | ||
rm -rf build dist) | ||
} | ||
|
||
# Build wheel | ||
cp /tmp/embag/bazel-bin/python/libembag.so /tmp/pip_build/embag | ||
(cd /tmp/pip_build && /opt/python/$version/bin/python setup.py bdist_wheel && \ | ||
auditwheel repair /tmp/pip_build/dist/embag*.whl --plat manylinux2014_x86_64 && \ | ||
/opt/python/$version/bin/pip install wheelhouse/embag*.whl && \ | ||
/opt/python/$version/bin/python -c 'import embag; embag.View(); print("Successfully loaded embag!")' &&\ | ||
cp wheelhouse/* /tmp/out && \ | ||
rm wheelhouse/* && \ | ||
rm -rf build dist) | ||
done | ||
# Build embag for Python 2 (soon to be deprecated) | ||
build "/usr/bin" 2 | ||
|
||
# Build embag for various version of Python 3 | ||
for version in cp35-cp35m \ | ||
cp36-cp36m \ | ||
cp37-cp37m \ | ||
cp38-cp38 \ | ||
cp39-cp39; do | ||
# Link the correct version of python | ||
ln -sf /opt/python/$version/bin/python /usr/bin/python3 | ||
|
||
build "/opt/python/$version/bin" 3 | ||
done |
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
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,24 @@ | ||
#import embag as rosbag | ||
import embag | ||
|
||
|
||
#bag = rosbag.Bag('_2019-05-29-18-10-41_190.bag') | ||
#bag = rosbag.Bag('truck-201_run-15955_2020-03-12-00-06-09_slim_107.bag') | ||
#bag = rosbag.Bag('truck-201_run-15955_2020-03-12-00-06-09_luminar_107.bag') | ||
|
||
#for topic, msg, t in bag.read_messages(topics=['/luminar_pointcloud']): | ||
#for topic, msg, t in bag.read_messages(topics=['/perception/tracked_lanes']): | ||
#for topic, msg, t in bag.read_messages(topics=['/applanix/nav']): | ||
#for topic, msg, t in bag.read_messages(topics=['/diagnostics']): | ||
# print(topic) | ||
# print(t) | ||
# print(msg) | ||
|
||
#bag.close() | ||
|
||
view = embag.View().addBag('/home/jason/Downloads/truck-203_run-16938_2020-06-29-21-50-28_slim_6.bag') | ||
for msg in view.getMessages('/diagnostics'): | ||
#for msg in view.getMessages('/self_driving_state'): | ||
print(msg.topic) | ||
print(msg.timestamp.to_sec()) | ||
print(msg) |
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