forked from python-mode/python-mode
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding a Dockerfile and helper scripts for tests
Now we can propperly test python-mode in an environment with a very well defined python version and a vim built/compiled for this specific version as well. The best way is to use the `build_docker_images.sh` file in order to create the docker image with all python versions you desire. Also, in order to run the container you just have to do: docker run --rm -it python-mode:<version> Related to python-mode#977
- Loading branch information
Showing
6 changed files
with
118 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Dockerfile | ||
.dockerignore |
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,48 @@ | ||
# VERSION 1.0.0 | ||
# AUTHOR: Diego Rabatone Oliveira (@diraol) | ||
# DESCRIPTION: Image used to test python-mode | ||
# BUILD: Use the build_docker_images.sh file | ||
# docker build -t python-mode:<VER> -f Dockerfile --build-arg PYTHON=<VER> . | ||
# SOURCE: https://github.com/python-mode/python-mode | ||
ARG PYTHON | ||
FROM python:$PYTHON | ||
|
||
# Passing arg inside the build stage | ||
ARG PYTHON | ||
|
||
# Never prompts the user for choices on installation/configuration of packages | ||
ENV DEBIAN_FRONTEND noninteractive | ||
ENV TERM linux | ||
|
||
# https://docs.python.org/3.6/using/cmdline.html#envvar-PYTHONUNBUFFERED | ||
# https://github.com/sclorg/s2i-python-container/issues/157 | ||
ENV PYTHONUNBUFFERED 1 | ||
|
||
# Clonning and building VIM for the specific python version | ||
COPY ./tests/utils/build_vim.sh /opt/build_vim.sh | ||
RUN set -ex \ | ||
&& cd /opt \ | ||
&& chmod +x build_vim.sh \ | ||
&& git clone https://github.com/vim/vim.git \ | ||
&& ./build_vim.sh ${PYTHON} \ | ||
&& rm -rf vim build_vim.sh | ||
|
||
ENV PYTHON_MODE_HOME /root/.vim/pack/foo/start/python-mode/ | ||
ENV VIM_RC /root/.vimrc | ||
ENV PYMODE_RC /root/.pymoderc | ||
ENV TEST_FILE /root/test.py | ||
|
||
COPY . ${PYTHON_MODE_HOME} | ||
RUN set -ex \ | ||
&& cd ${PYTHON_MODE_HOME} \ | ||
&& find . -type f -name '*.pyc' -delete \ | ||
&& find . -type d -name '__pycache__' -delete \ | ||
&& ln -s ${PYTHON_MODE_HOME}tests/utils/test.py ${TEST_FILE} \ | ||
&& ln -s ${PYTHON_MODE_HOME}tests/utils/pymoderc ${PYMODE_RC} \ | ||
&& ln -s ${PYTHON_MODE_HOME}tests/utils/vimrc ${VIM_RC} \ | ||
&& touch /root/.vimrc.before /root/.vimrc.after | ||
|
||
RUN set -ex && vim -e -s -c ':exec ":helptags ALL" | exec ":qall!"' | ||
|
||
WORKDIR /root | ||
ENTRYPOINT ["/bin/bash"] |
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,6 @@ | ||
#!/bin/bash | ||
|
||
for VER in 2.7 3.5 3.6 3.7 3.7.1 | ||
do | ||
docker build -t python-mode:${VER} --build-arg PYTHON=${VER} -f Dockerfile . | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
set -e | ||
SPACER="#####################################################################" | ||
|
||
PYTHON=$1 | ||
echo "Python version: ${PYTHON}" | ||
|
||
cd /opt/vim | ||
|
||
args=( ) | ||
# args+=( --with-features=huge ) | ||
args+=( --enable-multibyte ) | ||
args+=( --enable-cscope ) | ||
|
||
PYTHON_CONFIG_DIR=$(find /usr -type d -name 'config*' | grep python | grep -v dist-packages) | ||
|
||
if [[ ${PYTHON} =~ ^2 ]]; then | ||
args+=( --enable-pythoninterp=yes ) | ||
args+=( --with-python-config-dir=${PYTHON_CONFIG_DIR} ) | ||
else | ||
args+=( --enable-python3interp=yes ) | ||
args+=( --with-python3-config-dir=${PYTHON_CONFIG_DIR} ) | ||
fi | ||
|
||
args+=( --prefix=/usr/local ) | ||
|
||
echo ${SPACER} | ||
echo Starting build with args: ${args[@]} | ||
echo ${SPACER} | ||
|
||
./configure ${args[@]} | ||
|
||
make | ||
|
||
make install | ||
|
||
echo ${SPACER} | ||
echo vim installed with config args: ${args[@]} | ||
echo ${SPACER} |
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,7 @@ | ||
#!/bin/bash | ||
|
||
git reset --hard HEAD | ||
git checkout origin develop | ||
git pull origin develop | ||
git submodule sync --recursive | ||
git submodule update --init --recursive |