Skip to content
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

[IMP] use python3.8 for pre-commit-vauxoo #204

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/travis2docker/templates/Dockerfile_deployv
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ ENV {{ build_env_arg }}=TRUE
# Create cluster with odoo as owner and use environment variables instead of odoo cfg to connect
RUN . /home/odoo/build.sh && \
install_dev_tools && \
install_pcv && \
service_postgres_without_sudo odoo odoo && \
install_pgcli_venv && \
custom_alias && \
Expand Down
30 changes: 22 additions & 8 deletions src/travis2docker/templates/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,11 @@ install_dev_tools(){
py-spy \
virtualenv \
ipdb \
pre-commit-vauxoo \
diff-highlight \
pg-activity \
nodeenv \
pdbpp

# Symlinks used by vscode and possibly other tools.
PCV_DIR="$(python3 -c "import pre_commit_vauxoo as pcv; print(pcv.__path__[0])")/cfg"
ln -sf "${PCV_DIR}/.pylintrc" "${HOME}/.pylintrc"
ln -sf "${PCV_DIR}/.flake8" "${HOME}/.flake8"
ln -sf "${PCV_DIR}/.isort.cfg" "${HOME}/.isort.cfg"
ln -sf "${PCV_DIR}/.eslintrc.json" "${HOME}/.eslintrc.json"

# pre install pre-commit-vauxoo?
# sudo su odoo -c "git init /tmp/test && cd /tmp/test && pre-commit-vauxoo -f"
touch /home/odoo/full_test-requirements.txt
Expand Down Expand Up @@ -153,6 +145,28 @@ EOF
git clone --depth 1 -b master https://github.com/Vauxoo/emacs.d.git /home/odoo/.emacs.d
}

# Ensure pre-commit-vauxoo is installed on python3.8
install_pcv() {
[[ $(python3 --version) =~ [0-9]\.([0-9]+) ]]

if ! [[ ${BASH_REMATCH[1]} -lt 7 ]]; then
printf "INFO: Using python <= 3.7, installing python3.8 for pcv\n"
PYTHON=python3.8
apt install ${PYTHON} -y
curl -sSL https://bootstrap.pypa.io/get-pip.py | ${PYTHON} -
else
PYTHON=python3
fi
${PYTHON} -m pip install pre-commit-vauxoo

# Symlinks used by vscode and possibly other tools.
PCV_DIR="$(${PYTHON} -c "import pre_commit_vauxoo as pcv; print(pcv.__path__[0])")/cfg"
ln -sf "${PCV_DIR}/.pylintrc" "${HOME}/.pylintrc"
ln -sf "${PCV_DIR}/.flake8" "${HOME}/.flake8"
ln -sf "${PCV_DIR}/.isort.cfg" "${HOME}/.isort.cfg"
ln -sf "${PCV_DIR}/.eslintrc.json" "${HOME}/.eslintrc.json"
}

setup_coverage() {
echo "export MODULES2TEST=$(cd ${MAIN_REPO_FULL_PATH} && find * -name "__manifest__.py" -printf "/%h,")" >> ${HOME}/.bashrc
echo "export MODULES2INSTALL=$(cd ${MAIN_REPO_FULL_PATH} && find * -name "__manifest__.py" -printf "%h,")" >> ${HOME}/.bashrc
Expand Down
Loading