-
Notifications
You must be signed in to change notification settings - Fork 185
Ready: Make Riak PB a submodule #418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9aaf03c
498e093
e8ff23d
55dec06
0946771
508ad24
85c4ed7
d1de4bb
20cee68
3403f91
4fe3d16
03792c9
c251a00
c1f0e37
52ef8d7
88bf9c2
8fe089c
5dbad5f
76122ef
b2e1aef
3235bee
6bbb3fc
477a0ab
7885c90
9c098dd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [submodule "riak_pb"] | ||
| path = riak_pb | ||
| url = git://github.com/basho/riak_pb.git |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,7 @@ | ||
| include docs/* | ||
| include riak/erl_src/* | ||
| include THANKS | ||
| include README.rst | ||
| include LICENSE | ||
| include RELEASE_NOTES.md | ||
| include version.py | ||
| include commands.py | ||
| include commands.py |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| .PHONY: pb_clean pb_compile pb_build release | ||
|
|
||
| clean: pb_clean | ||
|
|
||
| pb_clean: | ||
| @echo "==> Python (clean)" | ||
| @rm -rf riak/pb/*_pb2.py riak/pb/*.pyc riak/pb/__pycache__ __pycache__ py-build | ||
|
|
||
| pb_compile: pb_clean | ||
| @echo "==> Python (compile)" | ||
| @protoc -Iriak_pb/src --python_out=riak/pb riak_pb/src/*.proto | ||
| @python setup.py build_messages | ||
|
|
||
| release: | ||
| ifeq ($(RELEASE_GPG_KEYNAME),) | ||
| $(error RELEASE_GPG_KEYNAME must be set to build a release and deploy this package) | ||
| else | ||
| @echo "==> Python 2.7 (release)" | ||
| @python2.7 setup.py build --build-base=py-build/2.7 bdist_egg upload -s -i $(RELEASE_GPG_KEYNAME) | ||
| @echo "==> Python 3.3 (release)" | ||
| @python3.3 setup.py build --build-base=py-build/3.3 bdist_egg upload -s -i $(RELEASE_GPG_KEYNAME) | ||
| @echo "==> Python 3.4 (release)" | ||
| @python3.4 setup.py build --build-base=py-build/3.4 bdist_egg upload -s -i $(RELEASE_GPG_KEYNAME) | ||
| @echo "==> Python 3.5 (release)" | ||
| @python3.5 setup.py build --build-base=py-build/3.5 bdist_egg upload -s -i $(RELEASE_GPG_KEYNAME) | ||
| endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,74 +1,104 @@ | ||
| #!/usr/bin/env bash | ||
| # pyenv root | ||
| export PYENV_ROOT="$HOME/.pyenv" | ||
| TEST_ROOT=$PWD/.. | ||
|
|
||
| # Install pyenv if it's missing | ||
| if [[ ! -d $PYENV_ROOT ]]; then | ||
| git clone git://github.com/yyuu/pyenv.git ${PYENV_ROOT} | ||
| cd ${PYENV_ROOT} | ||
| # Get the latest tagged version | ||
| git checkout `git tag | tail -1` | ||
| if [[ ! -d $PYENV_ROOT ]] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you are only looking for the existence of the variable, you can probably do
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I intended that to both check for existence of the variable and the directory to which it points, in one shot. |
||
| then | ||
| export PYENV_ROOT="$HOME/.pyenv" | ||
| fi | ||
|
|
||
| # Upgrade it, if it's too old | ||
| if [[ -z $(pyenv install --list | grep 3.4.3) ]]; then | ||
| cd ${PYENV_ROOT} | ||
| git pull origin master | ||
| git pull -u origin master | ||
| # Get the latest tagged version | ||
| git checkout `git tag | tail -1` | ||
| declare -r PROJDIR="$PWD/.." | ||
| if [[ ! -s $PROJDIR/riak/__init__.py ]] | ||
| then | ||
| echo "[ERROR] script must be run from the buildbot/ dir in github.com/basho/riak-python-client" 1>&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [[ ! -d ${PYENV_ROOT}/plugins/pyenv-virtualenv ]]; then | ||
| git clone https://github.com/yyuu/pyenv-virtualenv.git ${PYENV_ROOT}/plugins/pyenv-virtualenv | ||
| cd ${PYENV_ROOT}/plugins/pyenv-virtualenv | ||
| git checkout `git tag | tail -1` | ||
| # Install pyenv if it's missing | ||
| if [[ ! -d $PYENV_ROOT ]] | ||
| then | ||
| git clone https://github.com/yyuu/pyenv.git $PYENV_ROOT | ||
| else | ||
| (cd $PYENV_ROOT && git fetch --all) | ||
| fi | ||
|
|
||
| if [[ ! -d ${PYENV_ROOT}/plugins/pyenv-alias ]]; then | ||
| git clone https://github.com/s1341/pyenv-alias.git ${PYENV_ROOT}/plugins/pyenv-alias | ||
| (cd $PYENV_ROOT && git checkout $(git describe --tags $(git rev-list --tags --max-count=1))) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice! |
||
|
|
||
| declare -r pyenv_virtualenv_dir="$PYENV_ROOT/plugins/pyenv-virtualenv" | ||
| if [[ ! -d $pyenv_virtualenv_dir ]] | ||
| then | ||
| git clone https://github.com/yyuu/pyenv-virtualenv.git $pyenv_virtualenv_dir | ||
| else | ||
| (cd $pyenv_virtualenv_dir && git fetch --all) | ||
| fi | ||
|
|
||
| # Add pyenv root to PATH | ||
| # and initialize pyenv | ||
| PATH="$PYENV_ROOT/bin:$PATH" | ||
| # initialize pyenv | ||
| eval "$(pyenv init -)" | ||
| # initialize pyenv virtualenv | ||
| eval "$(pyenv virtualenv-init -)" | ||
| (cd $pyenv_virtualenv_dir && git checkout $(git describe --tags $(git rev-list --tags --max-count=1))) | ||
|
|
||
| # Now install (allthethings) versions for testing | ||
| if [[ -z $(pyenv versions | grep riak_3.4.3) ]]; then | ||
| VERSION_ALIAS="riak_3.4.3" pyenv install 3.4.3 | ||
| pyenv virtualenv riak_3.4.3 riak-py34 | ||
| declare -r pyenv_alias_dir="$PYENV_ROOT/plugins/pyenv-alias" | ||
| if [[ ! -d $pyenv_alias_dir ]] | ||
| then | ||
| git clone https://github.com/s1341/pyenv-alias.git $pyenv_alias_dir | ||
| else | ||
| (cd $pyenv_alias_dir && git pull origin master) | ||
| fi | ||
| if [[ -z $(pyenv versions | grep riak_3.3.6) ]]; then | ||
| VERSION_ALIAS="riak_3.3.6" pyenv install 3.3.6 | ||
| pyenv virtualenv riak_3.3.6 riak-py33 | ||
| fi | ||
| if [[ -z $(pyenv versions | grep riak_3.5.1) ]]; then | ||
| VERSION_ALIAS="riak_3.5.1" pyenv install 3.5.1 | ||
| pyenv virtualenv riak_3.5.1 riak-py35 | ||
|
|
||
| # Add pyenv root to PATH | ||
| # and initialize pyenv | ||
| if [[ $PATH != */.pyenv* ]] | ||
| then | ||
| echo "[INFO] adding $PYENV_ROOT/bin to PATH" | ||
| export PATH="$PYENV_ROOT/bin:$PATH" | ||
| fi | ||
| if [[ -z $(pyenv versions | grep riak_2.7.11) ]]; then | ||
| VERSION_ALIAS="riak_2.7.11" pyenv install 2.7.11 | ||
| pyenv virtualenv riak_2.7.11 riak-py27 | ||
|
|
||
| if [[ $(type -t pyenv) != 'function' ]] | ||
| then | ||
| echo "[INFO] init pyenv" | ||
| eval "$(pyenv init -)" | ||
| eval "$(pyenv virtualenv-init -)" | ||
| fi | ||
| if [[ -z $(pyenv versions | grep riak_2.7.8) ]]; then | ||
| VERSION_ALIAS="riak_2.7.8" pyenv install 2.7.8 | ||
| pyenv virtualenv riak_2.7.8 riak-py278 | ||
|
|
||
| # NB: 2.7.8 is special-cased | ||
| for pyver in 2.7 3.3 3.4 3.5 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Love how compact this is, but we also need to install Python 2.7.8 to test older versions of Python which still require PyOpenSSL for their security layer.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to test and support that version as it's more than a year old and not the latest version in the 2.7 series? The 2.7.X Python series end-of-life isn't until 2020, but that (in my opinion) means we only need to test on the latest version of that series. I can put code back to test this specific version (2.7.8) if we need to. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know that relatively current distros ship with old Pythons as their defaults. Ubuntu 14.04 ships with 2.7.3 and Centos 7 ships with 2.7.5, for example.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ugh! I'll put 2.7.8 back in. |
||
| do | ||
| if ! pyenv versions | fgrep -v 'riak_2.7.8' | fgrep -q "riak_$pyver" | ||
| then | ||
| declare -i pymaj="${pyver%.*}" | ||
| declare -i pymin="${pyver#*.}" | ||
| pyver_latest="$(pyenv install --list | grep -E "^[[:space:]]+$pymaj\\.$pymin\\.[[:digit:]]+\$" | tail -n1 | sed -e 's/[[:space:]]//g')" | ||
|
|
||
| echo "[INFO] installing Python $pyver_latest" | ||
| riak_pyver="riak_$pyver_latest" | ||
| VERSION_ALIAS="$riak_pyver" pyenv install "$pyver_latest" | ||
| pyenv virtualenv "$riak_pyver" "riak-py$pymaj$pymin" | ||
| fi | ||
| done | ||
|
|
||
| if ! pyenv versions | fgrep -q 'riak_2.7.8' | ||
| then | ||
| echo "[INFO] installing Python 2.7.8" | ||
| VERSION_ALIAS='riak_2.7.8' pyenv install '2.7.8' | ||
| pyenv virtualenv 'riak_2.7.8' 'riak-py278' | ||
| fi | ||
| pyenv global riak-py34 riak-py33 riak-py35 riak-py27 riak-py278 | ||
|
|
||
| (cd $PROJDIR && pyenv local riak-py35 riak-py34 riak-py33 riak-py27 riak-py278) | ||
|
|
||
| pyenv versions | ||
|
|
||
| # Now install tox | ||
| pip install --upgrade pip | ||
| if [ -z "`pip show tox`" ]; then | ||
| pip install -Iv tox | ||
| if [ -z "`pip show tox`" ]; then | ||
| echo "ERROR: Install of tox failed" | ||
| exit 1 | ||
| fi | ||
| if [[ $(python --version) == Python\ 3.* ]] | ||
| then | ||
| pip install --upgrade pip | ||
| for module in six tox python3-protobuf | ||
| do | ||
| if ! pip show --quiet $module | ||
| then | ||
| pip install --ignore-installed $module | ||
| if ! pip show --quiet $module | ||
| then | ||
| echo "[ERROR] install of $module failed" 1>&2 | ||
| exit 1 | ||
| fi | ||
| fi | ||
| done | ||
| pyenv rehash | ||
| else | ||
| echo "[ERROR] expected Python 3 to be 'python' at this point" 1>&2 | ||
| exit 1 | ||
| fi | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure
realpathis installed on all platforms by default. On CentOS 6, for example:$ realpath -bash: realpath: command not foundThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a GNU make built-in, not an external call.