[FIX] installation ubuntu poetry error
- poetry use env python - makefile add make install to install dev - check return status in install_locally - support OCA_maintainer-tools in fresh installation
This commit is contained in:
parent
6002309a68
commit
863ad4f434
7 changed files with 69 additions and 20 deletions
3
Makefile
3
Makefile
|
|
@ -51,6 +51,9 @@ run_code_generator:
|
||||||
#############
|
#############
|
||||||
# INSTALL #
|
# INSTALL #
|
||||||
#############
|
#############
|
||||||
|
.PHONY: install
|
||||||
|
install:install_os install_dev
|
||||||
|
|
||||||
.PHONY: install_dev
|
.PHONY: install_dev
|
||||||
install_dev:
|
install_dev:
|
||||||
./script/install_locally_dev.sh
|
./script/install_locally_dev.sh
|
||||||
|
|
|
||||||
|
|
@ -13,3 +13,4 @@ xlsxwriter
|
||||||
ldap
|
ldap
|
||||||
pythonjsonlogger
|
pythonjsonlogger
|
||||||
python-alipay-sdk
|
python-alipay-sdk
|
||||||
|
pyrfc
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,6 @@ pymysql = "^1.0.2"
|
||||||
pyotp = "^2.4.1"
|
pyotp = "^2.4.1"
|
||||||
pyparsing = "2.1.10"
|
pyparsing = "2.1.10"
|
||||||
pyproj = "^3.0.0"
|
pyproj = "^3.0.0"
|
||||||
pyrfc = "^0.1.2"
|
|
||||||
pyserial = "3.1.1"
|
pyserial = "3.1.1"
|
||||||
pysftp = "^0.2.9"
|
pysftp = "^0.2.9"
|
||||||
python-chess = "<0.24"
|
python-chess = "<0.24"
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,8 @@ sudo su - postgres -c "createuser -s ${EL_USER}" 2> /dev/null || true
|
||||||
echo -e "\n--- Installing debian dependency --"
|
echo -e "\n--- Installing debian dependency --"
|
||||||
sudo apt-get install git build-essential wget libxslt-dev libzip-dev libldap2-dev libsasl2-dev libpng12-0 gdebi-core libffi-dev libbz2-dev -y
|
sudo apt-get install git build-essential wget libxslt-dev libzip-dev libldap2-dev libsasl2-dev libpng12-0 gdebi-core libffi-dev libbz2-dev -y
|
||||||
sudo apt-get install libmariadbd-dev -y
|
sudo apt-get install libmariadbd-dev -y
|
||||||
|
# Dependencies for pyenv
|
||||||
|
sudo apt-get install make libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev liblzma-dev -y
|
||||||
|
|
||||||
echo -e "\n---- Installing nodeJS NPM and rtlcss for LTR support ----"
|
echo -e "\n---- Installing nodeJS NPM and rtlcss for LTR support ----"
|
||||||
sudo apt-get install nodejs npm -y
|
sudo apt-get install nodejs npm -y
|
||||||
|
|
|
||||||
|
|
@ -178,13 +178,20 @@ if [[ ! -d "./addons/addons" ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PYENV_PATH=~/.pyenv
|
PYENV_PATH=~/.pyenv
|
||||||
PYENV_VERSION_PATH=${PYENV_PATH}/versions/3.7.7
|
PYTHON_VERSION=3.7.7
|
||||||
|
PYENV_VERSION_PATH=${PYENV_PATH}/versions/${PYTHON_VERSION}
|
||||||
PYTHON_EXEC=${PYENV_VERSION_PATH}/bin/python
|
PYTHON_EXEC=${PYENV_VERSION_PATH}/bin/python
|
||||||
POETRY_PATH=~/.poetry
|
POETRY_PATH=~/.poetry
|
||||||
VENV_PATH=./.venv
|
VENV_PATH=./.venv
|
||||||
|
LOCAL_PYTHON_EXEC=${VENV_PATH}/bin/python
|
||||||
VENV_REPO_PATH=${VENV_PATH}/repo
|
VENV_REPO_PATH=${VENV_PATH}/repo
|
||||||
POETRY_VERSION=1.0.10
|
POETRY_VERSION=1.0.10
|
||||||
|
|
||||||
|
echo "Python path version home"
|
||||||
|
echo ${PYENV_VERSION_PATH}
|
||||||
|
echo "Python path version local"
|
||||||
|
echo ${LOCAL_PYTHON_EXEC}
|
||||||
|
|
||||||
if [[ ! -d "${PYENV_PATH}" ]]; then
|
if [[ ! -d "${PYENV_PATH}" ]]; then
|
||||||
echo -e "\n---- Installing pyenv in ${PYENV_PATH} ----"
|
echo -e "\n---- Installing pyenv in ${PYENV_PATH} ----"
|
||||||
curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
|
curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
|
||||||
|
|
@ -196,28 +203,37 @@ eval "$(pyenv init -)"
|
||||||
eval "$(pyenv virtualenv-init -)"
|
eval "$(pyenv virtualenv-init -)"
|
||||||
|
|
||||||
if [[ ! -d "${PYENV_VERSION_PATH}" ]]; then
|
if [[ ! -d "${PYENV_VERSION_PATH}" ]]; then
|
||||||
echo -e "\n---- Installing python 3.7.7 with pyenv in ${PYENV_VERSION_PATH} ----"
|
echo -e "\n---- Installing python ${PYTHON_VERSION} with pyenv in ${PYENV_VERSION_PATH} ----"
|
||||||
yes n|pyenv install 3.7.7
|
yes n|pyenv install ${PYTHON_VERSION}
|
||||||
|
if [[ $retVal -ne 0 ]]; then
|
||||||
|
echo "Error when installing pyenv"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pyenv local 3.7.7
|
pyenv local ${PYTHON_VERSION}
|
||||||
|
|
||||||
|
if [[ ! -d ${VENV_PATH} ]]; then
|
||||||
|
echo -e "\n---- Create Virtual environment Python ----"
|
||||||
|
if [[ -e ${PYTHON_EXEC} ]]; then
|
||||||
|
${PYTHON_EXEC} -m venv .venv
|
||||||
|
retVal=$?
|
||||||
|
if [[ $retVal -ne 0 ]]; then
|
||||||
|
echo "Virtual environment, error when creating .venv"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Missing pyenv, please refer installation guide."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ ! -d "${POETRY_PATH}" ]]; then
|
if [[ ! -d "${POETRY_PATH}" ]]; then
|
||||||
# Delete directory ~/.poetry and .venv to force update to new version
|
# Delete directory ~/.poetry and .venv to force update to new version
|
||||||
echo -e "\n---- Installing poetry for reliable python package ----"
|
echo -e "\n---- Installing poetry for reliable python package ----"
|
||||||
# curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | ${PYTHON_EXEC}
|
# curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | ${PYTHON_EXEC}
|
||||||
curl -fsS -o get-poetry.py https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py
|
curl -fsS -o get-poetry.py https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py
|
||||||
python get-poetry.py -y --preview --version ${POETRY_VERSION}
|
${LOCAL_PYTHON_EXEC} get-poetry.py -y --preview --version ${POETRY_VERSION}
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -d ${VENV_PATH} ]]; then
|
|
||||||
echo -e "\n---- Create Virtual environment Python ----"
|
|
||||||
if [[ -e ${PYTHON_EXEC} ]]; then
|
|
||||||
${PYTHON_EXEC} -m venv .venv
|
|
||||||
else
|
|
||||||
echo "Missing pyenv, please refer installation guide."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install git-repo if missing
|
# Install git-repo if missing
|
||||||
|
|
@ -232,9 +248,15 @@ fi
|
||||||
|
|
||||||
echo -e "\n---- Installing poetry dependency ----"
|
echo -e "\n---- Installing poetry dependency ----"
|
||||||
${VENV_PATH}/bin/pip install --upgrade pip
|
${VENV_PATH}/bin/pip install --upgrade pip
|
||||||
#/home/"${USER}"/.poetry/bin/poetry env use ${PYTHON_EXEC}
|
# Force python instead of changing env
|
||||||
source $HOME/.poetry/env
|
#/home/"${USER}"/.poetry/bin/poetry env use ${LOCAL_PYTHON_EXEC}
|
||||||
poetry install
|
# source $HOME/.poetry/env
|
||||||
|
${LOCAL_PYTHON_EXEC} ~/.poetry/bin/poetry install
|
||||||
|
retVal=$?
|
||||||
|
if [[ $retVal -ne 0 ]]; then
|
||||||
|
echo "Poetry installation error."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
# Delete artifacts created by pip, cause error in next "poetry install"
|
# Delete artifacts created by pip, cause error in next "poetry install"
|
||||||
rm -rf artifacts
|
rm -rf artifacts
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,26 @@
|
||||||
. ./env_var.sh
|
. ./env_var.sh
|
||||||
|
|
||||||
./script/install_locally.sh
|
./script/install_locally.sh
|
||||||
|
retVal=$?
|
||||||
|
if [[ $retVal -ne 0 ]]; then
|
||||||
|
echo "Error ./script/install_locally.sh"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Update git-repo
|
# Update git-repo
|
||||||
./script/update_manifest_local_dev.sh
|
./script/update_manifest_local_dev.sh
|
||||||
|
if [[ $retVal -ne 0 ]]; then
|
||||||
|
echo "Error manifest update, check git-repo."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Install maintainer-tools
|
# Install maintainer-tools
|
||||||
cd script/OCA_maintainer-tools
|
cd script/OCA_maintainer-tools
|
||||||
virtualenv env
|
# virtualenv is not installed by default
|
||||||
|
#virtualenv env
|
||||||
|
../../.venv/bin/python -m venv env
|
||||||
. env/bin/activate
|
. env/bin/activate
|
||||||
|
pip install setuptools-rust
|
||||||
python setup.py install
|
python setup.py install
|
||||||
#${VENV_PATH}/bin/pip install ./script/OCA_maintainer-tools/
|
#${VENV_PATH}/bin/pip install ./script/OCA_maintainer-tools/
|
||||||
|
cd -
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,15 @@
|
||||||
. ./env_var.sh
|
. ./env_var.sh
|
||||||
|
|
||||||
./script/install_locally.sh
|
./script/install_locally.sh
|
||||||
|
retVal=$?
|
||||||
|
if [[ $retVal -ne 0 ]]; then
|
||||||
|
echo "Error ./script/install_locally.sh"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Update git-repo
|
# Update git-repo
|
||||||
./script/update_manifest_prod.sh
|
./script/update_manifest_prod.sh
|
||||||
|
if [[ $retVal -ne 0 ]]; then
|
||||||
|
echo "Error manifest update, check git-repo."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue