Skip to content

Commit

Permalink
CI update: Use pyinstaller hooks instead of specifying --collect-data
Browse files Browse the repository at this point in the history
  • Loading branch information
Shengjie Xu committed Sep 10, 2024
1 parent 087353c commit 01680d3
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
run: python3 ./versionfile_gen.py
- name: run pyinstaller
run: |
pyinstaller --collect-data preppipe --collect-data pypinyin --recursive-copy-metadata preppipe --icon=preppipe.ico --version-file=versionfile.txt -n preppipe_cli -D preppipe_cli.py
pyinstaller --icon=preppipe.ico --version-file=versionfile.txt -n preppipe_cli -D preppipe_cli.py
cd dist/preppipe_cli && 7z.exe a -t7z -mx=9 ../preppipe_cli-windows-x64.7z *
- uses: "marvinpinto/action-automatic-releases@latest"
with:
Expand Down
4 changes: 4 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,7 @@ install_requires =

[options.packages.find]
where = src

[options.entry_points]
pyinstaller40 =
hook-dirs = preppipe.__pyinstaller:get_hook_dirs
7 changes: 7 additions & 0 deletions src/preppipe/__pyinstaller/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# SPDX-FileCopyrightText: 2024 PrepPipe's Contributors
# SPDX-License-Identifier: Apache-2.0

import os

def get_hook_dirs():
return [os.path.dirname(__file__)]
6 changes: 6 additions & 0 deletions src/preppipe/__pyinstaller/hook-preppipe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-FileCopyrightText: 2024 PrepPipe's Contributors
# SPDX-License-Identifier: Apache-2.0

from PyInstaller.utils.hooks import collect_data_files

datas = collect_data_files('preppipe', excludes=['__pyinstaller'])
6 changes: 6 additions & 0 deletions src/preppipe/__pyinstaller/hook-pypinyin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-FileCopyrightText: 2024 PrepPipe's Contributors
# SPDX-License-Identifier: Apache-2.0

from PyInstaller.utils.hooks import collect_data_files

datas = collect_data_files('pypinyin', excludes=['__pyinstaller'])

0 comments on commit 01680d3

Please sign in to comment.