diff --git a/oedp/build/oedp.spec b/oedp/build/oedp.spec index 02dbc7fc6311156a93e745f65cb120c6172e9770..456c72cdc60aafa58af20e6bcfb40740862a7bc0 100644 --- a/oedp/build/oedp.spec +++ b/oedp/build/oedp.spec @@ -36,23 +36,7 @@ install -c -m 0400 %{_builddir}/%{name}-%{version}/static/* %{buildroot}%{_usr}/ install -c -m 0500 %{_builddir}/%{name}-%{version}/oedp.py %{buildroot}%{_bindir}/oedp -%post -set -e - -# 创建 Python 虚拟环境 -cd %{_var}/oedp/python/venv -python3 -m venv oedp - -# 创建软连接 -python_version_info=$(python3 --version) -major_minor_version=$(echo ${python_version_info} | awk '{split($2, v, "."); print "python" v[1] "." v[2]}') -site_packages_dir=%{_var}/oedp/python/venv/oedp/lib/${major_minor_version}/site-packages -ln -s %{_usr}/lib/oedp/src %{_var}/oedp/python/venv/oedp/lib/${major_minor_version}/site-packages/src - - %postun -set -e - # 删除可能会残留的目录 rm -rf /var/oedp rm -rf /usr/lib/oedp diff --git a/oedp/oedp.py b/oedp/oedp.py index 9ab71cb7d310b2faf49e005bb0bb7d8034bc28a2..164e221f40e7a65543c3f7b75ec4e5b775ec14f7 100644 --- a/oedp/oedp.py +++ b/oedp/oedp.py @@ -14,12 +14,9 @@ import sys -if f'/var/oedp/python/venv/lib/python{sys.version_info.major}.{sys.version_info.minor}/site-packages' not in sys.path: - sys.path.insert( - 0, - f'/var/oedp/python/venv/oedp/lib/python{sys.version_info.major}.{sys.version_info.minor}/site-packages' - ) - sys.executable = '/var/oedp/python/venv/oedp/bin/python' +if '/usr/lib/oedp' not in sys.path: + sys.path.append('/usr/lib/oedp') + sys.executable = '/usr/bin/python3' from src.constants.const import FAILED, OK from src.parsers.oedp_parser import OeDeployParser