зеркало из https://github.com/github/vitess-gh.git
bootstrap: Do no longer install gRPC Python dependencies manually.
Since gRPC 0.13, the gRPC Python install process takes care of downloading python modules like "six" or "google.protobuf".
The new install process also no longer requires "tox", hence we dropped that dependency as well.
This commit also fixes the issue which was introduced in commit 938f31743d
.
When we changed the install command flag for protobuf python from --root to --prefix, a system wide python package would always trump the locally installed version. Due to that, we could no longer run the e2e tests on our desktops. Since we no longer manually install protobuf python, this issue goes away. Before I had that solution, I did some analysis why the system wide version gets imported instead of the local version.
If --prefix is used, protobuf python is installed as an .egg file in the "site-packages" directory.
If --root is used, the .py files are copied to the "dist-packages" directory instead.
For unknown reasons, the .egg file in "site-packages" was not used when calling "import google.protobuf".
Here's what it looked like:
--prefix: (not working)
$ python -v
>>> import google.protobuf
[...]
import google # loaded from Zip /home/mberlin/workspace/vitess/dist/grpc/usr/local/lib/python2.7/site-packages/protobuf-3.0.0b2-py2.7-linux-x86_64.egg/google/__init__.pyc
import google.protobuf # directory /usr/lib/python2.7/dist-packages/google/protobuf
import google.protobuf # precompiled from /usr/lib/python2.7/dist-packages/google/protobuf/__init__.pyc
>>>
--root: (working)
$ python -v
>>> import google.protobuf
import google.protobuf # directory /home/mberlin/workspace/vitess/dist/grpc/usr/local/lib/python2.7/dist-packages/google/protobuf
import google.protobuf # precompiled from /home/mberlin/workspace/vitess/dist/grpc/usr/local/lib/python2.7/dist-packages/google/protobuf/__init__.pyc
>>>
This commit is contained in:
Родитель
d0d5ca2358
Коммит
58e72c1a9c
|
@ -87,11 +87,6 @@ else
|
|||
export PATH=$(prepend_path $PATH $grpc_dist/usr/local/bin)
|
||||
export LD_LIBRARY_PATH=$(prepend_path $LD_LIBRARY_PATH $grpc_dist/usr/local/lib)
|
||||
|
||||
if [ `uname -s` == "Darwin" ]; then
|
||||
# on OSX tox is installed in the following path
|
||||
export PATH=$(prepend_path $PATH /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/bin)
|
||||
fi
|
||||
|
||||
./travis/install_grpc.sh $grpc_dist || fail "gRPC build failed"
|
||||
echo "$grpc_ver" > $grpc_dist/.build_finished
|
||||
|
||||
|
|
|
@ -11,14 +11,13 @@ if [ -n "$grpc_dist" ]; then
|
|||
cd $grpc_dist
|
||||
fi
|
||||
|
||||
# for python, we'll need the latest virtualenv and tox.
|
||||
# running gRPC requires the six package, version >=1.10.
|
||||
# Python requires a very recent version of virtualenv.
|
||||
if [ -n "$grpc_dist" ]; then
|
||||
# Create a virtualenv, which also creates a virualenv-boxed pip.
|
||||
virtualenv $grpc_dist/usr/local
|
||||
$grpc_dist/usr/local/bin/pip install --upgrade --ignore-installed virtualenv tox six
|
||||
$grpc_dist/usr/local/bin/pip install --upgrade --ignore-installed virtualenv
|
||||
else
|
||||
pip install --upgrade --ignore-installed virtualenv tox six
|
||||
pip install --upgrade --ignore-installed virtualenv
|
||||
fi
|
||||
|
||||
# clone the repository, setup the submodules
|
||||
|
@ -48,18 +47,8 @@ else
|
|||
make install
|
||||
fi
|
||||
|
||||
# build and install python protobuf side
|
||||
cd python
|
||||
if [ -n "$grpc_dist" ]; then
|
||||
python setup.py build --cpp_implementation
|
||||
python setup.py install --cpp_implementation --prefix=$grpc_dist/usr/local
|
||||
else
|
||||
python setup.py build --cpp_implementation
|
||||
python setup.py install --cpp_implementation
|
||||
fi
|
||||
|
||||
# now install grpc itself
|
||||
cd ../../..
|
||||
cd ../..
|
||||
if [ -n "$grpc_dist" ]; then
|
||||
make install prefix=$grpc_dist/usr/local
|
||||
else
|
||||
|
|
Загрузка…
Ссылка в новой задаче