From 2bd813b1b5bcff840cfb9972fd6dba1af1e41687 Mon Sep 17 00:00:00 2001 From: Josh Haberman Date: Thu, 9 Apr 2015 16:41:58 -0700 Subject: [PATCH 1/3] Added Python to Travis build and clarified setup instructions. --- .travis.yml | 2 ++ python/README.md | 26 ++++++++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index c7834924ae..daac9192e2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,8 @@ script: - ./autogen.sh && ./configure && make -j2 - cd java && mvn test && cd .. - cd javanano && mvn test && cd .. + - cd python && python setup.py build && python setup.py google_test + - LD_LIBRARY_PATH=../src/.libs cd python && python setup.py build --cpp_implementation && python setup.py google_test --cpp_implementation - make distcheck -j2 notifications: email: false diff --git a/python/README.md b/python/README.md index ee7e7213e3..bf92a9437e 100644 --- a/python/README.md +++ b/python/README.md @@ -52,8 +52,18 @@ Installation $ python setup.py build $ python setup.py google_test - If you want to build/test c++ implementation, run: + To build the C++ implementation run: $ python setup.py build --cpp_implementation + + To test and use the C++ implementation, you must make libprotobuf.so + from the C++ build accessible. You can either install the C++ code + you built, or set LD_LIBRARY_PATH: + + $ (cd .. && make install) + or + $ export LD_LIBRARY_PATH=../src/.libs + + Then run the tests like so: $ python setup.py google_test --cpp_implementation If some tests fail, this library may not work correctly on your @@ -73,12 +83,13 @@ Installation or: + $ (cd .. && make install) $ python setup.py install --cpp_implementation This step may require superuser privileges. - NOTE: To use C++ implementation, you need to install C++ protobuf runtime - library of the same version and export the environment variable before this - step. See the "C++ Implementation" section below for more details. + NOTE: To use C++ implementation, you need to export an environment + variable before running your program. See the "C++ Implementation" + section below for more details. Usage ===== @@ -100,12 +111,7 @@ To use the C++ implementation, you need to: 2) Export an environment variable: $ export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp - $ export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION=2 -You need to export this variable before running setup.py script to build and -install the extension. You must also set the variable at runtime, otherwise +You must set this variable at runtime, before running your program, otherwise the pure-Python implementation will be used. In a future release, we will change the default so that C++ implementation is used whenever it is available. -It is strongly recommended to run `python setup.py test` after setting the -variable to "cpp", so the tests will be against C++ implemented Python -messages. From 0f2e72668d1a07c71988c8e20f4f90f356de70c8 Mon Sep 17 00:00:00 2001 From: Josh Haberman Date: Thu, 9 Apr 2015 17:05:38 -0700 Subject: [PATCH 2/3] Fix for current directory in Travis tests. --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index daac9192e2..65818bdb7f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,8 +11,8 @@ script: - ./autogen.sh && ./configure && make -j2 - cd java && mvn test && cd .. - cd javanano && mvn test && cd .. - - cd python && python setup.py build && python setup.py google_test - - LD_LIBRARY_PATH=../src/.libs cd python && python setup.py build --cpp_implementation && python setup.py google_test --cpp_implementation + - cd python && python setup.py build && python setup.py google_test && cd .. + - LD_LIBRARY_PATH=../src/.libs cd python && python setup.py build --cpp_implementation && python setup.py google_test --cpp_implementation && cd .. - make distcheck -j2 notifications: email: false From 2f56bf9819e6e4f69c30209512c028f9c2ad7f5d Mon Sep 17 00:00:00 2001 From: Josh Haberman Date: Thu, 9 Apr 2015 17:12:00 -0700 Subject: [PATCH 3/3] Export LD_LIBRARY_PATH. --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 65818bdb7f..b8435f77f4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,8 @@ script: - cd java && mvn test && cd .. - cd javanano && mvn test && cd .. - cd python && python setup.py build && python setup.py google_test && cd .. - - LD_LIBRARY_PATH=../src/.libs cd python && python setup.py build --cpp_implementation && python setup.py google_test --cpp_implementation && cd .. + - export LD_LIBRARY_PATH=../src/.libs + - cd python && python setup.py build --cpp_implementation && python setup.py google_test --cpp_implementation && cd .. - make distcheck -j2 notifications: email: false