GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Adding a Dockerfile and helper scripts for tests · diraol/python-mode@a59c832

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • Dockerfile
  • build_docker_images.sh
  • readme.md
  • tests/utils
    • build_vim.sh
    • reset_update_repo.sh
    • vimrc
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Dockerfile‎

Copy file name to clipboard
+42Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# VERSION 1.0.0
2+
# AUTHOR: Diego Rabatone Oliveira (@diraol)
3+
# DESCRIPTION: Image used to test python-mode
4+
# BUILD: Use the build_docker_images.sh file
5+
# docker build -t python-mode:<VER> -f Dockerfile --build-arg PYTHON=<VER> .
6+
# SOURCE: https://github.com/python-mode/python-mode
7+
ARG PYTHON
8+
FROM python:$PYTHON
9+
10+
# Passing arg inside the build stage
11+
ARG PYTHON
12+
13+
# Never prompts the user for choices on installation/configuration of packages
14+
ENV DEBIAN_FRONTEND noninteractive
15+
ENV TERM linux
16+
17+
# https://docs.python.org/3.6/using/cmdline.html#envvar-PYTHONUNBUFFERED
18+
# https://github.com/sclorg/s2i-python-container/issues/157
19+
ENV PYTHONUNBUFFERED 1
20+
21+
# Clonning and building VIM for the specific python version
22+
COPY ./tests/utils/build_vim.sh /root/build_vim.sh
23+
RUN set -ex \
24+
&& cd /root \
25+
&& chmod +x build_vim.sh \
26+
&& git clone https://github.com/vim/vim.git \
27+
&& ./build_vim.sh ${PYTHON}
28+
29+
ENV VIM_RC /root/.vimrc
30+
ENV PYTHON_MODE_HOME /root/.vim/pack/foo/start/python-mode/
31+
32+
WORKDIR ${PYTHON_MODE_HOME}
33+
34+
COPY . ${PYTHON_MODE_HOME}
35+
RUN set -ex \
36+
&& cd ${PYTHON_MODE_HOME} \
37+
&& find . -type f -name '*.pyc' -delete \
38+
&& find . -type d -name '__pycache__' -delete \
39+
&& cp ${PYTHON_MODE_HOME}tests/utils/vimrc.python-mode ~/.vimrc.python-mode \
40+
&& cp ${PYTHON_MODE_HOME}tests/utils/vimrc ${VIM_RC}
41+
42+
ENTRYPOINT ["/bin/bash"]
Collapse file

‎build_docker_images.sh‎

Copy file name to clipboard
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
for VER in 2.7 3.5 3.6 3.7 3.7.1
4+
do
5+
docker build -t python-mode:${VER} --build-arg PYTHON=${VER} -f Dockerfile .
6+
done
Collapse file

‎readme.md‎

Copy file name to clipboardExpand all lines: readme.md
+17Lines changed: 17 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ If your question is not described there then you already know what to do
141141
Nevertheless just a refresher on how to submit bugs:
142142

143143
**(From the FAQ)**
144+
144145
Clear all python cache/compiled files (`*.pyc` files and `__pycache__`
145146
directory and everything under it). In Linux/Unix/MacOS you can run:
146147

@@ -160,6 +161,22 @@ plugin seems broken.
160161

161162
***Do check for sensitive information in the file before submitting.***
162163

164+
## Docker environment
165+
Now you can try python-mode within a docker container, with a python-version
166+
from your choice and a vim built for that python version.
167+
168+
To build the docker images you should use the script `build_docker_images.sh`
169+
that is located on the root of this repo.
170+
171+
To run the container for a specific version, after building it, you can do:
172+
173+
`docker run --rm -it python-mode:<PYTHON_VERSION>`
174+
175+
* PYTHON\_VERSION can be 2.7, 3.7, etc.
176+
177+
If you do not want the container to be removed after you exit it, just remove
178+
the `--rm` from the command above.
179+
163180
# Frequent problems
164181

165182
Read this section before opening an issue on the tracker.
Collapse file

‎tests/utils/build_vim.sh‎

Copy file name to clipboard
+39Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
set -e
3+
SPACER="#####################################################################"
4+
5+
PYTHON=$1
6+
echo "Python version: ${PYTHON}"
7+
8+
cd /root/vim
9+
10+
args=( )
11+
# args+=( --with-features=huge )
12+
args+=( --enable-multibyte )
13+
args+=( --enable-cscope )
14+
15+
PYTHON_CONFIG_DIR=$(find /usr -type d -name 'config*' | grep python | grep -v dist-packages)
16+
17+
if [[ ${PYTHON} =~ ^2 ]]; then
18+
args+=( --enable-pythoninterp=yes )
19+
args+=( --with-python-config-dir=${PYTHON_CONFIG_DIR} )
20+
else
21+
args+=( --enable-python3interp=yes )
22+
args+=( --with-python3-config-dir=${PYTHON_CONFIG_DIR} )
23+
fi
24+
25+
args+=( --prefix=/usr/local )
26+
27+
echo ${SPACER}
28+
echo Starting build with args: ${args[@]}
29+
echo ${SPACER}
30+
31+
./configure ${args[@]}
32+
33+
make
34+
35+
make install
36+
37+
echo ${SPACER}
38+
echo vim installed with config args: ${args[@]}
39+
echo ${SPACER}
Collapse file

‎tests/utils/reset_update_repo.sh‎

Copy file name to clipboard
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
git reset --hard HEAD
4+
git checkout origin develop
5+
git pull origin develop
6+
git submodule sync --recursive
7+
git submodule update --init --recursive
Collapse file

‎tests/utils/vimrc‎

Copy file name to clipboard
+28Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
" Run vim with command:
2+
"
3+
" $ vim -u ./debug.vim /my/py/file.py
4+
"
5+
" Only python-mode will be loaded.
6+
source ~/.vimrc.python-mode
7+
syntax on
8+
filetype plugin indent on
9+
set shortmess=at
10+
set cmdheight=10
11+
set ft=python
12+
set shell=bash
13+
set runtimepath=
14+
set runtimepath+=/root/.vim/pack/foo/start/python-mode
15+
set term=xterm-256color
16+
set wrap " visually wrap lines
17+
set smartindent " smart indenting
18+
set shiftwidth=4 " default to two spaces
19+
set tabstop=4 " default to two spaces
20+
set softtabstop=4 " default to two spaces
21+
set shiftround " always round indentation to shiftwidth
22+
set mouse= " disable mouse
23+
set expandtab
24+
25+
" Modify vimrc configuration.
26+
execute('set rtp+='. expand('<sfile>:p:h'))
27+
set rtp -=$HOME/.vim
28+
set rtp -=$HOME/.vim/after

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.