Skip to content

Commit

Permalink
【Hackathon 8th No.7】Python版本适配 2 (#3967)
Browse files Browse the repository at this point in the history
* auto opencc

* Update setup.py
  • Loading branch information
Liyulingyue authored Jan 16, 2025
1 parent 29216b6 commit bbf83c4
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,26 @@
VERSION = '0.0.0'
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 = [
"braceexpand",
"editdistance",
Expand All @@ -48,7 +68,7 @@
"matplotlib<=3.8.4",
"nara_wpe",
"onnxruntime>=1.11.0",
"opencc==1.1.6",
determine_opencc_version(), # opencc or opencc==1.1.6
"opencc-python-reimplemented",
"pandas",
"paddleaudio>=1.1.0",
Expand Down

0 comments on commit bbf83c4

Please sign in to comment.