在preinstall开始,添加os和包架构的是否一致的判断
This commit is contained in:
@ -19,15 +19,17 @@ import sys
|
||||
import sysconfig
|
||||
import platform
|
||||
import re
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
|
||||
def checkPythonVersion():
|
||||
pythonVersion = sys.version_info[0:2]
|
||||
distName = platform.platform()
|
||||
if pythonVersion < (3, 0):
|
||||
def check_python_version():
|
||||
python_version = sys.version_info[0:2]
|
||||
dist_name = platform.platform()
|
||||
if python_version < (3, 0):
|
||||
raise Exception("[GAUSS-52200] : version of python"
|
||||
" is not correct: %s." %
|
||||
distName + " should use Python 3.*")
|
||||
dist_name + " should use Python 3.*")
|
||||
return True
|
||||
|
||||
def check_python_compiler_option():
|
||||
@ -37,11 +39,37 @@ def check_python_compiler_option():
|
||||
carry the -enable-shared parameters")
|
||||
return True
|
||||
|
||||
def check_os_and_package_arch():
|
||||
"""
|
||||
check os and package arch
|
||||
"""
|
||||
clib_path = os.path.realpath(
|
||||
os.path.join(os.path.realpath(__file__), "../../clib"))
|
||||
package_cmd = "cd " + clib_path + "&& file libcrypto.so.1.1 2>/dev/null"
|
||||
(status, output) = subprocess.getstatusoutput(package_cmd)
|
||||
if status != 0:
|
||||
raise Exception("%s command faile." % (package_cmd))
|
||||
package_arch = ""
|
||||
if ("x86-64" in output):
|
||||
package_arch = "x86_64"
|
||||
if ("aarch64" in output):
|
||||
package_arch = "aarch64"
|
||||
|
||||
os_cmd = "uname -p"
|
||||
(status, output) = subprocess.getstatusoutput(os_cmd)
|
||||
if status != 0:
|
||||
raise Exception("%s command failed." % (os_cmd))
|
||||
os_arch = output
|
||||
|
||||
if (package_arch == os_arch):
|
||||
return
|
||||
raise Exception("System and software package architecture mismatch.\n" +
|
||||
"Error: os architecture is %s, package architecture is %s" % (os_arch, package_arch))
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
check_python = checkPythonVersion()
|
||||
if check_python:
|
||||
CHECK_PYTHON = check_python_version()
|
||||
if CHECK_PYTHON:
|
||||
check_python_compiler_option()
|
||||
except Exception as e:
|
||||
raise Exception(e)
|
||||
|
Reference in New Issue
Block a user