Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
mozillazg committed Sep 15, 2024
2 parents d9c0de0 + c64f490 commit 476d20c
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 2 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@ Changelog
---------


`0.53.0`_ (2024-09-15)
+++++++++++++++++++++++++

* **[New]** 内置对 pyinstaller 打包的支持,
避免使用 pyinstaller 打包时需要额外处理类似 `no such file or dictionary: pinyin_dict.json` 错误的问题。
( **未增加新的依赖包** ,仅通过在源码中增加 __pyinstaller 目录,
支持使用 pyinstaller 打包依赖了 pypinyin 的项目时自动打包 v0.52.0 版本新引入的 json 文件)
via `#329`_ Thanks `@xushengj`_ , 详见 `#326`_ 。



`0.52.0`_ (2024-08-04)
+++++++++++++++++++++++++

Expand Down Expand Up @@ -1024,15 +1035,18 @@ __ https://github.com/mozillazg/python-pinyin/issues/8
.. _#291: https://github.com/mozillazg/python-pinyin/issues/291
.. _#319: https://github.com/mozillazg/python-pinyin/issues/319
.. _#322: https://github.com/mozillazg/python-pinyin/issues/322
.. _#326: https://github.com/mozillazg/python-pinyin/issues/326
.. _#164: https://github.com/mozillazg/python-pinyin/pull/164
.. _#176: https://github.com/mozillazg/python-pinyin/pull/176
.. _#279: https://github.com/mozillazg/python-pinyin/pull/279
.. _#318: https://github.com/mozillazg/python-pinyin/pull/318
.. _#324: https://github.com/mozillazg/python-pinyin/pull/324
.. _#329: https://github.com/mozillazg/python-pinyin/pull/329
.. _@hanabi1224: https://github.com/hanabi1224
.. _@yangwe1: https://github.com/yangwe1
.. _@Freed-Wu: https://github.com/Freed-Wu
.. _@serfend: https://github.com/serfend
.. _@xushengj: https://github.com/xushengj
.. _变调规则: https://en.wikipedia.org/wiki/Standard_Chinese_phonology#Tone_sandhi

.. _0.2.0: https://github.com/mozillazg/python-pinyin/compare/v0.1.0...v0.2.0
Expand Down Expand Up @@ -1127,3 +1141,4 @@ __ https://github.com/mozillazg/python-pinyin/issues/8
.. _0.50.0: https://github.com/mozillazg/python-pinyin/compare/v0.49.0...v0.50.0
.. _0.51.0: https://github.com/mozillazg/python-pinyin/compare/v0.50.0...v0.51.0
.. _0.52.0: https://github.com/mozillazg/python-pinyin/compare/v0.51.0...v0.52.0
.. _0.53.0: https://github.com/mozillazg/python-pinyin/compare/v0.52.0...v0.53.0
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,15 @@ Related Projects
* `hotoo/pinyin`__: 汉字拼音转换工具 Node.js/JavaScript 版。
* `mozillazg/go-pinyin`__: 汉字拼音转换工具 Go 版。
* `mozillazg/rust-pinyin`__: 汉字拼音转换工具 Rust 版。
* `wolfgitpr/cpp-pinyin`__: 汉字拼音转换工具 c++ 版。
* `wolfgitpr/csharp-pinyin`__: 汉字拼音转换工具 c# 版。


__ https://github.com/hotoo/pinyin
__ https://github.com/mozillazg/go-pinyin
__ https://github.com/mozillazg/rust-pinyin
__ https://github.com/wolfgitpr/cpp-pinyin
__ https://github.com/wolfgitpr/csharp-pinyin


.. |Build| image:: https://img.shields.io/circleci/project/github/mozillazg/python-pinyin/master.svg
Expand Down
4 changes: 4 additions & 0 deletions README_en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,15 @@ Related Projects
* `hotoo/pinyin`__: A tool for converting Chinese characters to pinyin, Node.js/JavaScript version.
* `mozillazg/go-pinyin`__: A tool for converting Chinese characters to pinyin, Go version.
* `mozillazg/rust-pinyin`__: A tool for converting Chinese characters to pinyin, Rust version.
* `wolfgitpr/cpp-pinyin`__: A tool for converting Chinese characters to pinyin, Cpp version.
* `wolfgitpr/csharp-pinyin`__: A tool for converting Chinese characters to pinyin, C# version.


__ https://github.com/hotoo/pinyin
__ https://github.com/mozillazg/go-pinyin
__ https://github.com/mozillazg/rust-pinyin
__ https://github.com/wolfgitpr/cpp-pinyin
__ https://github.com/wolfgitpr/csharp-pinyin


.. |Build| image:: https://img.shields.io/circleci/project/github/mozillazg/python-pinyin/master.svg
Expand Down
5 changes: 5 additions & 0 deletions README_ru.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,15 @@ Related Projects
* `hotoo/pinyin`__: Утилита для пиньин конвертации китайских иероглифов Node.js/JavaScript версия.
* `mozillazg/go-pinyin`__: Утилита для пиньин конвертации китайских иероглифов Go версия.
* `mozillazg/rust-pinyin`__: Утилита для пиньин конвертации китайских иероглифов Rust версия.
* `wolfgitpr/cpp-pinyin`__: Утилита для пиньин конвертации китайских иероглифов Cpp версия.
* `wolfgitpr/csharp-pinyin`__: Утилита для пиньин конвертации китайских иероглифов C# версия.


__ https://github.com/hotoo/pinyin
__ https://github.com/mozillazg/go-pinyin
__ https://github.com/mozillazg/rust-pinyin
__ https://github.com/wolfgitpr/cpp-pinyin
__ https://github.com/wolfgitpr/csharp-pinyin


.. |Build| image:: https://img.shields.io/travis/mozillazg/python-pinyin/master.svg
Expand Down
7 changes: 7 additions & 0 deletions pypinyin/__pyinstaller/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# reference: https://github.com/pyinstaller/hooksample/blob/master/src/pyi_hooksample/__pyinstaller/__init__.py # noqa

import os


def get_hook_dirs():
return [os.path.dirname(__file__)]
4 changes: 4 additions & 0 deletions pypinyin/__pyinstaller/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from typing import Text, List


def get_hook_dirs() -> List[Text]: ...
6 changes: 6 additions & 0 deletions pypinyin/__pyinstaller/hook-pypinyin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# reference: https://github.com/pyinstaller/hooksample/blob/master/src/pyi_hooksample/__pyinstaller/hook-pyi_hooksample.py # noqa

from PyInstaller.utils.hooks import collect_data_files # type: ignore

datas = collect_data_files(
'pypinyin', excludes=['__pyinstaller'])
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ python_files = test_*.py
python_classes = Test
python_functions = test
addopts = -slv --cov-report term-missing --tb=short --durations=10 --doctest-modules
norecursedirs = .git __pycache__
norecursedirs = .git __pycache__ pypinyin/__pyinstaller
2 changes: 1 addition & 1 deletion requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ pygments>=2.7.4 # not directly required, pinned by Snyk to avoid a vulnerability
pytest
pytest-cov
pytest-random-order
setuptools
Sphinx>=3.0.4
tox
twine
wheel>=0.21
setuptools
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
'pypinyin.seg',
'pypinyin.style',
'pypinyin.tools',
'pypinyin.__pyinstaller',
]

requirements = []
Expand Down Expand Up @@ -77,6 +78,9 @@ def long_description():
'console_scripts': [
'pypinyin = pypinyin.__main__:main',
],
'pyinstaller40': [
'hook-dirs = pypinyin.__pyinstaller:get_hook_dirs'
],
},
classifiers=[
'Development Status :: 5 - Production/Stable',
Expand Down

0 comments on commit 476d20c

Please sign in to comment.