Skip to content

Commit

Permalink
升级 OpenCC 第三方依赖库到 v1.1.7 版本 (#753)
Browse files Browse the repository at this point in the history
  • Loading branch information
CairoLee committed Jan 16, 2024
1 parent 1440cd8 commit e3f369c
Show file tree
Hide file tree
Showing 18 changed files with 569 additions and 2,002 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/opencc/.appveyor.yml
Expand Up @@ -9,8 +9,8 @@ environment:
matrix:
# Build Node.js
- nodejs_version: stable
- nodejs_version: 20
- nodejs_version: 18
- nodejs_version: 16

# Build plain C++
- nodejs_version: none
Expand Down
32 changes: 32 additions & 0 deletions 3rdparty/opencc/.github/workflows/mingw.yml
@@ -0,0 +1,32 @@
name: mingw-w64 CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: msys2/setup-msys2@v2
- uses: actions/checkout@v3
- name: Install dependencies
run: pacman -S --noconfirm base-devel mingw-w64-x86_64-toolchain cmake ninja python
- name: Build with mingw-w64
run: |
CC=/mingw64/bin/cc CXX=/mingw64/bin/c++ cmake \
-B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DENABLE_GTEST=ON \
-DBUILD_SHARED_LIBS=OFF
cmake --build build
- name: Run test
run: |
cd build
ctest
2 changes: 1 addition & 1 deletion 3rdparty/opencc/.github/workflows/nodejs.yml
Expand Up @@ -13,7 +13,7 @@ jobs:

strategy:
matrix:
node-version: [16.x, 18.x]
node-version: [18.x, 20.x]

steps:
- uses: actions/checkout@v2
Expand Down
39 changes: 36 additions & 3 deletions 3rdparty/opencc/.github/workflows/python.yml
Expand Up @@ -12,18 +12,18 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, '3.10', '3.11']
python-version: [3.8, 3.9, '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest wheel
pip install flake8 pytest wheel setuptools
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
Expand All @@ -35,3 +35,36 @@ jobs:
run: python setup.py build_ext install
- name: Test with pytest
run: cd python && pytest

test-pypi:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v1

- name: Build package and upload from docker (Linux)
if: runner.os == 'Linux'
run: |
docker run --rm -v "${PWD}:/opt/OpenCC" \
-e TWINE_USERNAME=__token__ \
-e TWINE_PASSWORD=${{ secrets.PYPI_TOKEN }} \
ubuntu:22.04 /bin/bash /opt/OpenCC/release-pypi-linux.sh testonly
- name: Build package and upload (macOS)
if: runner.os == 'macOS'
run: bash release-pypi-macos.sh testonly
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}

- name: Build package and upload (Windows)
if: runner.os == 'Windows'
run: |
C:\Miniconda/condabin/conda.bat init powershell
./release-pypi-windows.cmd testonly
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
2 changes: 1 addition & 1 deletion 3rdparty/opencc/.github/workflows/release-pypi.yml
Expand Up @@ -19,7 +19,7 @@ jobs:
docker run --rm -v "${PWD}:/opt/OpenCC" \
-e TWINE_USERNAME=__token__ \
-e TWINE_PASSWORD=${{ secrets.PYPI_TOKEN }} \
ubuntu:18.04 /bin/bash /opt/OpenCC/release-pypi-linux.sh
ubuntu:22.04 /bin/bash /opt/OpenCC/release-pypi-linux.sh
- name: Build package and upload (macOS)
if: runner.os == 'macOS'
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/opencc/.travis.yml
Expand Up @@ -6,8 +6,8 @@ cache:

node_js:
- stable
- 20
- 18
- 16

os:
- linux
Expand Down
27 changes: 26 additions & 1 deletion 3rdparty/opencc/CMakeLists.txt
Expand Up @@ -42,7 +42,7 @@ set (PACKAGE_URL https://github.com/BYVoid/Opencc)
set (PACKAGE_BUGREPORT https://github.com/BYVoid/Opencc/issues)
set (OPENCC_VERSION_MAJOR 1)
set (OPENCC_VERSION_MINOR 1)
set (OPENCC_VERSION_REVISION 5)
set (OPENCC_VERSION_REVISION 7)

if (CMAKE_BUILD_TYPE MATCHES Debug)
set (version_suffix .Debug)
Expand Down Expand Up @@ -105,6 +105,10 @@ set (DIR_SHARE_LOCALE ${DIR_SHARE}/locale/)

######## Configuration

include(CMakePackageConfigHelpers)

set(targets_export_name OpenCCTargets)

configure_file(
opencc.pc.in
opencc.pc
Expand All @@ -118,6 +122,27 @@ install(
${DIR_LIBRARY}/pkgconfig
)

write_basic_package_version_file(
OpenCCConfigVersion.cmake
VERSION ${OPENCC_VERSION}
COMPATIBILITY SameMajorVersion
)

configure_package_config_file(
OpenCCConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/OpenCCConfig.cmake
INSTALL_DESTINATION ${DIR_LIBRARY}/cmake/opencc
PATH_VARS DIR_INCLUDE
)

install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/OpenCCConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/OpenCCConfigVersion.cmake
DESTINATION
${DIR_LIBRARY}/cmake/opencc
)

######## Compiler flags

add_definitions(
Expand Down
10 changes: 10 additions & 0 deletions 3rdparty/opencc/NEWS.md
@@ -1,5 +1,15 @@
# Change History of OpenCC

## Version 1.1.7

2023年10月15日

* 添加提交时 python 包重建以验证包生成 ([#822](https://github.com/BYVoid/OpenCC/pull/822))。
* 支持Python 3.12 和 Node 20,移除針對Python 3.7和Node 16的構建 ([#820](https://github.com/BYVoid/OpenCC/pull/820))。
* add mingw-w64 ci ([#802](https://github.com/BYVoid/OpenCC/pull/802))。
* Add support of CMake config modules ([#763](https://github.com/BYVoid/OpenCC/pull/763))。
* 若干其他小修復。

## Version 1.1.6

2022年12月08日
Expand Down
7 changes: 7 additions & 0 deletions 3rdparty/opencc/OpenCCConfig.cmake.in
@@ -0,0 +1,7 @@
@PACKAGE_INIT@

include(${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake)

set_and_check(OPENCC_INCLUDE_DIR @PACKAGE_DIR_INCLUDE@/opencc)

check_required_components(OpenCC)
2 changes: 1 addition & 1 deletion 3rdparty/opencc/README.md
Expand Up @@ -77,7 +77,7 @@ converter.convert('汉字') # 漢字
#include "opencc.h"

int main() {
const SimpleConverter converter("s2t.json");
const opencc::SimpleConverter converter("s2t.json");
converter.Convert("汉字"); // 漢字
return 0;
}
Expand Down
13 changes: 10 additions & 3 deletions 3rdparty/opencc/data/dictionary/STPhrases.txt
Expand Up @@ -9789,6 +9789,9 @@
南征北伐 南征北伐
南征北战 南征北戰
南征北讨 南征北討
南斗 南斗
南斗六星 南斗六星
南斗星君 南斗星君
南方周末 南方週末
南无阿弥陀佛 南無阿彌陀佛
南曲 南曲
Expand Down Expand Up @@ -22112,6 +22115,7 @@
形同虚设 形同虛設
形同陌路 形同陌路
形名参同 形名參同
形如斗 形如斗
形孤影只 形孤影隻
形容尽致 形容盡致
形影相吊 形影相弔
Expand Down Expand Up @@ -27161,6 +27165,7 @@
斗子 斗子
斗室 斗室
斗室生辉 斗室生輝
斗宿 斗宿
斗富 鬥富
斗小马 斗小馬
斗尾港 斗尾港
Expand Down Expand Up @@ -27194,10 +27199,12 @@
斗斛之禄 斗斛之祿
斗方 斗方
斗方名士 斗方名士
斗星官 斗星官
斗智 鬥智
斗智不斗力 鬥智不鬥力
斗智斗力 鬥智鬥力
斗暴 鬥暴
斗木獬 斗木獬
斗杓 斗杓
斗杓东指 斗杓東指
斗杓转势 斗杓轉勢
Expand Down Expand Up @@ -31395,9 +31402,9 @@
气充志骄 氣充志驕
气克斗牛 氣克斗牛
气冲冲 氣沖沖
气冲斗牛 氣衝斗牛
气冲牛斗 氣衝牛斗
气冲霄汉 氣衝霄漢
气冲斗牛 氣沖斗牛
气冲牛斗 氣沖牛斗
气冲霄汉 氣沖霄漢
气出 氣出
气力用尽 氣力用盡
气动控制 氣動控制
Expand Down
1 change: 1 addition & 0 deletions 3rdparty/opencc/data/dictionary/TWPhrasesIT.txt
Expand Up @@ -244,6 +244,7 @@ U盤 隨身碟
磁盤 磁碟
磁道 磁軌
社區 社羣 社區
禁用 停用
移動硬盤 行動硬碟
移動網絡 行動網路
移動資料 行動資料
Expand Down

0 comments on commit e3f369c

Please sign in to comment.