【Hackathon 8th No.7】Python版本适配 2 (#3967)

* auto opencc

* Update setup.py
pull/3974/head
张春乔 8 months ago committed by GitHub
parent 29216b6f60
commit bbf83c4a4e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -31,6 +31,26 @@ HERE = Path(os.path.abspath(os.path.dirname(__file__)))
VERSION = '0.0.0' VERSION = '0.0.0'
COMMITID = 'none' COMMITID = 'none'
def determine_opencc_version():
# get gcc version
gcc_version = None
try:
output = sp.check_output(
['gcc', '--version'], stderr=sp.STDOUT, text=True)
for line in output.splitlines():
if "gcc" in line:
gcc_version = line.split()[-1]
except Exception as e:
gcc_version = None
# determine opencc version
if gcc_version:
if int(gcc_version.split(".")[0]) <= 9:
return "opencc==1.1.6" # GCC<=9 need opencc==1.1.6
return "opencc" # default
base = [ base = [
"braceexpand", "braceexpand",
"editdistance", "editdistance",
@ -48,7 +68,7 @@ base = [
"matplotlib<=3.8.4", "matplotlib<=3.8.4",
"nara_wpe", "nara_wpe",
"onnxruntime>=1.11.0", "onnxruntime>=1.11.0",
"opencc==1.1.6", determine_opencc_version(), # opencc or opencc==1.1.6
"opencc-python-reimplemented", "opencc-python-reimplemented",
"pandas", "pandas",
"paddleaudio>=1.1.0", "paddleaudio>=1.1.0",

Loading…
Cancel
Save