From beb6dd874ade7f026370ab810e92ba816b87f7a0 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sun, 24 Nov 2024 05:41:55 +0800 Subject: [PATCH] update --- plugins/php-apt/index.py | 12 +++++------- plugins/php-apt/index_php_apt.py | 14 ++++++-------- plugins/php-yum/index.py | 12 +++++------- plugins/php-yum/index_php_yum.py | 14 ++++++-------- plugins/php/index.py | 12 +++++------- plugins/php/index_php.py | 17 +++++------------ 6 files changed, 32 insertions(+), 49 deletions(-) diff --git a/plugins/php-apt/index.py b/plugins/php-apt/index.py index b3906c33d..b5abc0efb 100755 --- a/plugins/php-apt/index.py +++ b/plugins/php-apt/index.py @@ -9,14 +9,12 @@ import json import shutil -sys.path.append(os.getcwd() + "/class/core") -import mw +web_dir = os.getcwd() + "/web" +if os.path.exists(web_dir): + sys.path.append(web_dir) + os.chdir(web_dir) -if mw.isAppleSystem(): - cmd = 'ls /usr/local/lib/ | grep python | cut -d \\ -f 1 | awk \'END {print}\'' - info = mw.execShell(cmd) - p = "/usr/local/lib/" + info[0].strip() + "/site-packages" - sys.path.append(p) +import core.mw as mw app_debug = False if mw.isAppleSystem(): diff --git a/plugins/php-apt/index_php_apt.py b/plugins/php-apt/index_php_apt.py index 0be394d49..2562967a4 100755 --- a/plugins/php-apt/index_php_apt.py +++ b/plugins/php-apt/index_php_apt.py @@ -8,14 +8,12 @@ import re import json import shutil -# reload(sys) -# sys.setdefaultencoding('utf8') - -try: - sys.path.append(os.getcwd() + "/class/core") - import mw -except Exception as e: - import core.mw as mw +web_dir = os.getcwd() + "/web" +if os.path.exists(web_dir): + sys.path.append(web_dir) + os.chdir(web_dir) + +import core.mw as mw if mw.isAppleSystem(): cmd = 'ls /usr/local/lib/ | grep python | cut -d \\ -f 1 | awk \'END {print}\'' diff --git a/plugins/php-yum/index.py b/plugins/php-yum/index.py index 2d0c87ad3..fefbed017 100755 --- a/plugins/php-yum/index.py +++ b/plugins/php-yum/index.py @@ -9,14 +9,12 @@ import json import shutil -sys.path.append(os.getcwd() + "/class/core") -import mw +web_dir = os.getcwd() + "/web" +if os.path.exists(web_dir): + sys.path.append(web_dir) + os.chdir(web_dir) -if mw.isAppleSystem(): - cmd = 'ls /usr/local/lib/ | grep python | cut -d \\ -f 1 | awk \'END {print}\'' - info = mw.execShell(cmd) - p = "/usr/local/lib/" + info[0].strip() + "/site-packages" - sys.path.append(p) +import core.mw as mw app_debug = False if mw.isAppleSystem(): diff --git a/plugins/php-yum/index_php_yum.py b/plugins/php-yum/index_php_yum.py index 1a77fb329..11ea23240 100755 --- a/plugins/php-yum/index_php_yum.py +++ b/plugins/php-yum/index_php_yum.py @@ -8,14 +8,12 @@ import re import json import shutil -# reload(sys) -# sys.setdefaultencoding('utf8') - -try: - sys.path.append(os.getcwd() + "/class/core") - import mw -except Exception as e: - import core.mw as mw +web_dir = os.getcwd() + "/web" +if os.path.exists(web_dir): + sys.path.append(web_dir) + os.chdir(web_dir) + +import core.mw as mw app_debug = False if mw.isAppleSystem(): diff --git a/plugins/php/index.py b/plugins/php/index.py index ac905c358..f08c86485 100755 --- a/plugins/php/index.py +++ b/plugins/php/index.py @@ -11,14 +11,12 @@ import shutil # reload(sys) # sys.setdefaultencoding('utf8') -sys.path.append(os.getcwd() + "/class/core") -import mw +web_dir = os.getcwd() + "/web" +if os.path.exists(web_dir): + sys.path.append(web_dir) + os.chdir(web_dir) -if mw.isAppleSystem(): - cmd = 'ls /usr/local/lib/ | grep python | cut -d \\ -f 1 | awk \'END {print}\'' - info = mw.execShell(cmd) - p = "/usr/local/lib/" + info[0].strip() + "/site-packages" - sys.path.append(p) +import core.mw as mw app_debug = False if mw.isAppleSystem(): diff --git a/plugins/php/index_php.py b/plugins/php/index_php.py index bfd9bca31..617613b1e 100755 --- a/plugins/php/index_php.py +++ b/plugins/php/index_php.py @@ -8,19 +8,12 @@ import re import json import shutil -# reload(sys) -# sys.setdefaultencoding('utf8') -try: - sys.path.append(os.getcwd() + "/class/core") - import mw -except Exception as e: - import core.mw as mw +web_dir = os.getcwd() + "/web" +if os.path.exists(web_dir): + sys.path.append(web_dir) + os.chdir(web_dir) -if mw.isAppleSystem(): - cmd = 'ls /usr/local/lib/ | grep python | cut -d \\ -f 1 | awk \'END {print}\'' - info = mw.execShell(cmd) - p = "/usr/local/lib/" + info[0].strip() + "/site-packages" - sys.path.append(p) +import core.mw as mw app_debug = False if mw.isAppleSystem():