Fix virtualenv configuration

This commit is contained in:
VirtuBox
2020-10-26 14:21:04 +01:00
parent 009b5e1af6
commit 295b8420cf
3 changed files with 60 additions and 16 deletions

View File

@@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### v3.9.x - [Unreleased] ### v3.9.x - [Unreleased]
#### Fixed
- Python virtualenv configuration
#### v3.13.0 - 2020-10-25 #### v3.13.0 - 2020-10-25
#### Added #### Added

67
install
View File

@@ -209,13 +209,15 @@ wo_install_dep() {
# install dependencies # install dependencies
apt-get -option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --assume-yes install \ apt-get -option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --assume-yes install \
build-essential curl gzip python3-pip python3-apt python3-venv gcc python3-dev sqlite3 git tar software-properties-common pigz \ build-essential curl gzip python3-pip python3-apt python3-venv gcc python3-dev sqlite3 git tar software-properties-common pigz \
gnupg2 cron ccze rsync apt-transport-https tree haveged ufw unattended-upgrades tzdata ntp zstd idn >/dev/null 2>&1 gnupg2 cron ccze rsync apt-transport-https tree haveged ufw unattended-upgrades tzdata ntp zstd idn \
python3-distutils-extra libapt-pkg-dev >/dev/null 2>&1
curl -sL https://download.opensuse.org/repositories/home:/virtubox:/WordOps/xUbuntu_18.04/Release.key | apt-key add - curl -sL https://download.opensuse.org/repositories/home:/virtubox:/WordOps/xUbuntu_18.04/Release.key | apt-key add -
else else
# install dependencies # install dependencies
apt-get -option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --assume-yes install \ apt-get -option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --assume-yes install \
build-essential curl gzip dirmngr sudo python3-pip python3-apt python3-venv gcc python3-dev ca-certificates sqlite3 git tar \ build-essential curl gzip dirmngr sudo python3-pip python3-apt python3-venv gcc python3-dev ca-certificates sqlite3 git tar \
software-properties-common pigz apt-transport-https gnupg2 cron ccze rsync tree haveged ufw unattended-upgrades tzdata ntp zstd idn >/dev/null 2>&1 software-properties-common pigz apt-transport-https gnupg2 cron ccze rsync tree haveged ufw unattended-upgrades tzdata ntp zstd idn \
python3-distutils-extra libapt-pkg-dev >/dev/null 2>&1
# add php repository gpg key # add php repository gpg key
[ -d /etc/apt/trusted.gpg.d ] && { wget -qO /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg; } [ -d /etc/apt/trusted.gpg.d ] && { wget -qO /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg; }
# add nginx repository gpg key # add nginx repository gpg key
@@ -427,22 +429,41 @@ wo_install_acme_sh() {
wo_install() { wo_install() {
local python_ver local python_ver
python_ver=$(python3 -c "import sys; print(sys.version_info[1])") python_ver=$(python3 -c "import sys; print(sys.version_info[1])")
local wo_distro_codename
wo_distro_codename=$(lsb_release -sc)
local wo_linux_distro
wo_linux_distro=$(lsb_release -is)
if [ -d /usr/local/lib/python3."$python_ver"/dist-packages ]; then if [ -d /usr/local/lib/python3."$python_ver"/dist-packages ]; then
cd /usr/local/lib/python3."$python_ver"/dist-packages || exit 1 cd /usr/local/lib/python3."$python_ver"/dist-packages || exit 1
fi fi
python3 -m pip uninstall -yq wo wordops ee python3 -m pip uninstall -yq wo wordops ee
if [ -d /opt/wo ]; then if [ -d /opt/wo/lib/python3."$python_ver"/site-packages/apt ]; then
cd /opt/wo || exit 1 source /opt/wo/bin/activate
source bin/activate python3 -m pip install -U pip setuptools wheel
else else
mkdir -p /opt/wo rm -rf /opt/wo
cd /opt || exit 1 python3 -m venv /opt/wo
python3 -m venv --system-site-packages wo source /opt/wo/bin/activate
source wo/bin/activate python3 -m pip install -U pip setuptools wheel
if [ "$wo_linux_distro" = "Debian" ] || [ "$wo_linux_distro" = "Raspbian" ]; then
if [ "$wo_distro_codename" = "strech" ]; then
python3 -m pip install git+https://salsa.debian.org/apt-team/python-apt.git@1.4.y#egg=python-apt
else
python3 -m pip install git+https://salsa.debian.org/apt-team/python-apt.git@1.8.4.y#egg=python-apt
fi
else
if [ "$wo_distro_codename" = "focal" ]; then
python3 -m pip install git+https://salsa.debian.org/apt-team/python-apt.git@2.0.0#egg=python-apt
elif [ "$wo_distro_codename" = "bionic" ]; then
python3 -m pip install git+https://salsa.debian.org/apt-team/python-apt.git@1.6.y#egg=python-apt
else
python3 -m pip install git+https://salsa.debian.org/apt-team/python-apt.git@1.1.y-xenial#egg=python-apt
fi
fi
fi fi
python3 -m pip install -U pip setuptools wheel
if [ "$wo_branch" = "master" ]; then if [ "$wo_branch" = "master" ]; then
python3 -m pip install -I wordops python3 -m pip install -U wordops
else else
python3 -m pip install -I "git+git://github.com/WordOps/WordOps.git@$wo_branch#egg=wordops" python3 -m pip install -I "git+git://github.com/WordOps/WordOps.git@$wo_branch#egg=wordops"
fi fi
@@ -462,14 +483,30 @@ wo_travis_install() {
rm -rf dist rm -rf dist
fi fi
if [ -f ./setup.py ]; then if [ -f ./setup.py ]; then
if [ -d /opt/wo ]; then if [ -d /opt/wo/lib/python3."$python_ver"/site-packages/apt ]; then
source /opt/wo/bin/activate source /opt/wo/bin/activate
python3 -m pip install -U pip setuptools wheel
else else
mkdir -p /opt/wo rm -rf /opt/wo
python3 -m venv --system-site-packages /opt/wo python3 -m venv /opt/wo
source /opt/wo/bin/activate source /opt/wo/bin/activate
python3 -m pip install -U pip setuptools wheel
if [ "$wo_linux_distro" = "Debian" ] || [ "$wo_linux_distro" = "Raspbian" ]; then
if [ "$wo_distro_codename" = "strech" ]; then
python3 -m pip install git+https://salsa.debian.org/apt-team/python-apt.git@1.4.y#egg=python-apt
else
python3 -m pip install git+https://salsa.debian.org/apt-team/python-apt.git@1.8.4.y#egg=python-apt
fi
else
if [ "$wo_distro_codename" = "focal" ]; then
python3 -m pip install git+https://salsa.debian.org/apt-team/python-apt.git@2.0.0#egg=python-apt
elif [ "$wo_distro_codename" = "bionic" ]; then
python3 -m pip install git+https://salsa.debian.org/apt-team/python-apt.git@1.6.y#egg=python-apt
else
python3 -m pip install git+https://salsa.debian.org/apt-team/python-apt.git@1.1.y-xenial#egg=python-apt
fi
fi
fi fi
python3 -m pip install -U pip setuptools wheel
python3 -m pip install -U . python3 -m pip install -U .
else else
python3 -m pip install -U "git+git://github.com/WordOps/WordOps.git@$wo_branch#egg=wordops" python3 -m pip install -U "git+git://github.com/WordOps/WordOps.git@$wo_branch#egg=wordops"

View File

@@ -444,7 +444,10 @@ class WOSiteDeleteController(CementBaseController):
# TODO Delete nginx conf # TODO Delete nginx conf
removeNginxConf(self, wo_domain) removeNginxConf(self, wo_domain)
deleteSiteInfo(self, wo_domain) deleteSiteInfo(self, wo_domain)
WOAcme.removeconf(self, wo_domain) # To improve
if not WOFileUtils.grepcheck(
self, '/var/www/22222/conf/nginx/ssl.conf', wo_domain):
WOAcme.removeconf(self, wo_domain)
Log.info(self, "Deleted site {0}".format(wo_domain)) Log.info(self, "Deleted site {0}".format(wo_domain))