Update install for pip

This commit is contained in:
VirtuBox
2019-10-21 11:37:19 +02:00
parent ef84caeea9
commit 6eceb5ed35
3 changed files with 28 additions and 14 deletions

33
install
View File

@@ -30,7 +30,7 @@ TPUT_ECHO=$(tput setaf 4)
wo_lib_echo() { wo_lib_echo() {
echo "${TPUT_ECHO}${*}${TPUT_RESET}" echo -e "${TPUT_ECHO}${*}${TPUT_RESET}"
} }
wo_lib_echo_info() { wo_lib_echo_info() {
@@ -111,10 +111,16 @@ command_exists() {
# run functions and exit on failure # run functions and exit on failure
_run() { _run() {
if [ -n "$2" ]; then if [ -n "$2" ]; then
wo_lib_echo "$2" wo_lib_echo "$2\r"
fi fi
if ! { "$1" >> "$wo_install_log" 2>&1; }; then if ! { "$1" >> "$wo_install_log" 2>&1; }; then
exit 1 if [ -n "$2" ]; then
wo_lib_echo_fail "$2"
fi
else
if [ -n "$2" ]; then
wo_lib_echo "$2 [OK]"
fi
fi fi
} }
@@ -221,6 +227,8 @@ wo_install_dep() {
if [ ! -f /etc/apt/apt.conf.d/20auto-upgrades ]; then if [ ! -f /etc/apt/apt.conf.d/20auto-upgrades ]; then
cp /usr/share/unattended-upgrades/20auto-upgrades /etc/apt/apt.conf.d/20auto-upgrades cp /usr/share/unattended-upgrades/20auto-upgrades /etc/apt/apt.conf.d/20auto-upgrades
fi fi
# upgrade pip
python3 -m pip install --upgrade pip
} }
@@ -447,8 +455,9 @@ wo_download() {
# WordOps install # WordOps install
wo_install() { wo_install() {
cd /var/lib/wo/tmp/WordOps-install || exit 1 python3 -m pip install --upgrade wordops
python3 setup.py install cp -rn /usr/local/lib/python3.*/dist-packages/usr/* /usr/
cp -rn /usr/local/lib/python3.*/dist-packages/etc/* /etc/
} }
@@ -458,11 +467,13 @@ wo_travis_install() {
if [ "$wo_force_install" = "y" ]; then if [ "$wo_force_install" = "y" ]; then
[ ! -f "$HOME/.gitconfig" ] && { bash -c 'echo -e "[user]\n\tname = $USER\n\temail = root@$HOSTNAME.local" > $HOME/.gitconfig'; } [ ! -f "$HOME/.gitconfig" ] && { bash -c 'echo -e "[user]\n\tname = $USER\n\temail = root@$HOSTNAME.local" > $HOME/.gitconfig'; }
fi fi
if [ -d ./dist ]; then
if [ -f "$HOME/.gitconfig" ]; then rm -rf dist
# install and redirect log to not print python package install
python3 setup.py install
fi fi
python3 setup.py sdist bdist_wheel
python3 -m pip install --upgrade dist/*.whl
cp -rn /usr/local/lib/python3.*/dist-packages/usr/* /usr/
cp -rn /usr/local/lib/python3.*/dist-packages/etc/* /etc/
} }
@@ -549,7 +560,7 @@ wo_upgrade_nginx() {
systemctl start nginx systemctl start nginx
fi fi
[ -f /var/lib/wo/tmp/nginx-block ] && { mv /var/lib/wo/tmp/nginx-block /etc/apt/preferences.d/nginx-block; } [ -f /var/lib/wo/tmp/nginx-block ] && { mv /var/lib/wo/tmp/nginx-block /etc/apt/preferences.d/nginx-block; }
return 0
} }
wo_update_latest() { wo_update_latest() {
@@ -665,7 +676,7 @@ wo_nginx_tweak() {
} }
wo_clean() { wo_clean() {
rm -rf /usr/local/lib/python3.*/dist-packages/wo-* /usr/local/lib/python3.*/dist-packages/wordops-* rm -rf /usr/local/lib/python3.*/dist-packages/wo-*.egg /usr/local/lib/python3.*/dist-packages/wordops-*.egg
} }

View File

@@ -28,7 +28,7 @@ if os.geteuid() == 0:
setup(name='wordops', setup(name='wordops',
version='3.9.9.4', version='3.9.9.4',
description='WordPress & server administration toolset', description='An essential toolset that eases server administration',
long_description=LONG, long_description=LONG,
long_description_content_type='text/markdown', long_description_content_type='text/markdown',
classifiers=[ classifiers=[

View File

@@ -2,6 +2,7 @@
import os import os
import urllib.request import urllib.request
import requests
from cement.core.controller import CementBaseController, expose from cement.core.controller import CementBaseController, expose
@@ -74,8 +75,10 @@ class WOCleanController(CementBaseController):
def clean_opcache(self): def clean_opcache(self):
try: try:
Log.info(self, "Cleaning opcache") Log.info(self, "Cleaning opcache")
urllib.request.urlopen("https://127.0.0.1:22222/cache" opgui = requests.get(
"/opcache/opgui.php?reset=1").read() "https://127.0.0.1:22222/cache/opcache/opgui.php?reset=1")
if opgui.status_code != '200':
Log.warn(self, 'Cleaning opcache failed')
except Exception as e: except Exception as e:
Log.debug(self, "{0}".format(e)) Log.debug(self, "{0}".format(e))
Log.debug(self, "Unable hit url, " Log.debug(self, "Unable hit url, "