Skip to content

Commit 0004311

Browse files
committed
win to onefolder, linux/maxos to onefile
1 parent 85d031e commit 0004311

File tree

5 files changed

+100
-35
lines changed

5 files changed

+100
-35
lines changed

.github/workflows/release.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,16 @@ jobs:
108108
poetry-version: ${{ env.POETRY_VERSION }}
109109
python-version: ${{ env.PYTHON_VERSION }}
110110
without: test
111-
- name: Run PyInstaller
111+
- name: Run PyInstaller (linux/macos)
112+
if: matrix.tag == 'linux' || matrix.tag == 'macos'
113+
run: |
114+
poetry run pyinstaller scanner.spec
115+
cp ./config.sample.ini ./dist/config.ini
116+
cp ./README.md ./dist/README.md
117+
cp ./LICENSE ./dist/LICENSE
118+
./dist/scanner -v
119+
- name: Run PyInstaller (win)
120+
if: matrix.tag == 'win'
112121
run: |
113122
poetry run pyinstaller scanner.spec
114123
cp ./config.sample.ini ./dist/scanner/config.ini
@@ -121,7 +130,7 @@ jobs:
121130
run: echo "FILENAME=scanner-${{ github.ref_name }}-${{ matrix.tag }}.zip" | sed -r 's,/,-,g' >> $GITHUB_OUTPUT
122131
- name: Zip files (linux/macos)
123132
if: matrix.tag == 'linux' || matrix.tag == 'macos'
124-
run: cd ./dist/scanner; zip -r ../../${{ steps.filename.outputs.FILENAME }} *
133+
run: zip -j ./${{ steps.filename.outputs.FILENAME }} ./dist/*
125134
- name: Zip files (win)
126135
if: matrix.tag == 'win'
127136
run: Compress-Archive ./dist/scanner/* ./${{ steps.filename.outputs.FILENAME }}

poetry.lock

Lines changed: 19 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
aiohttp==3.9.5 ; python_version >= "3.9" and python_version < "3.13"
22
aiosignal==1.3.1 ; python_version >= "3.9" and python_version < "3.13"
33
anyio==4.3.0 ; python_version >= "3.9" and python_version < "3.13"
4-
apprise==1.7.6 ; python_version >= "3.9" and python_version < "3.13"
4+
apprise==1.8.0 ; python_version >= "3.9" and python_version < "3.13"
55
async-timeout==4.0.3 ; python_version >= "3.9" and python_version < "3.11"
66
attrs==23.2.0 ; python_version >= "3.9" and python_version < "3.13"
77
cachetools==5.3.3 ; python_version >= "3.9" and python_version < "3.13"
@@ -38,4 +38,4 @@ sniffio==1.3.1 ; python_version >= "3.9" and python_version < "3.13"
3838
typing-extensions==4.11.0 ; python_version >= "3.9" and python_version < "3.11"
3939
urllib3==2.2.1 ; python_version >= "3.9" and python_version < "3.13"
4040
yarl==1.9.4 ; python_version >= "3.9" and python_version < "3.13"
41-
zipp==3.18.1 ; python_version >= "3.9" and python_version < "3.10"
41+
zipp==3.18.2 ; python_version >= "3.9" and python_version < "3.10"

scanner.spec

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ tmp_ret = collect_all('cron_descriptor')
1212
datas += tmp_ret[0]; binaries += tmp_ret[1]; hiddenimports += tmp_ret[2]
1313
datas += copy_metadata('tgtg_scanner')
1414

15+
block_cipher = None
16+
17+
1518
a = Analysis(
1619
['tgtg_scanner/__main__.py'],
1720
pathex=[],
@@ -24,21 +27,25 @@ a = Analysis(
2427
excludes=[],
2528
win_no_prefer_redirects=False,
2629
win_private_assemblies=False,
30+
cipher=block_cipher,
2731
noarchive=False,
28-
optimize=0,
2932
)
30-
pyz = PYZ(a.pure)
33+
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
3134

3235
exe = EXE(
3336
pyz,
3437
a.scripts,
38+
a.binaries,
39+
a.zipfiles,
40+
a.datas,
3541
[],
36-
exclude_binaries=True,
3742
name='scanner',
3843
debug=False,
3944
bootloader_ignore_signals=True,
4045
strip=False,
4146
upx=True,
47+
upx_exclude=[],
48+
runtime_tmpdir=None,
4249
console=True,
4350
disable_windowed_traceback=False,
4451
argv_emulation=False,
@@ -47,12 +54,3 @@ exe = EXE(
4754
entitlements_file=None,
4855
icon='icon.ico',
4956
)
50-
coll = COLLECT(
51-
exe,
52-
a.binaries,
53-
a.datas,
54-
strip=False,
55-
upx=True,
56-
upx_exclude=[],
57-
name='scanner',
58-
)

scanner_win.spec

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# -*- mode: python ; coding: utf-8 -*-
2+
from PyInstaller.utils.hooks import collect_all, copy_metadata
3+
4+
datas = []
5+
binaries = []
6+
hiddenimports = []
7+
tmp_ret = collect_all('apprise')
8+
datas += tmp_ret[0]; binaries += tmp_ret[1]; hiddenimports += tmp_ret[2]
9+
tmp_ret = collect_all('humanize')
10+
datas += tmp_ret[0]; binaries += tmp_ret[1]; hiddenimports += tmp_ret[2]
11+
tmp_ret = collect_all('cron_descriptor')
12+
datas += tmp_ret[0]; binaries += tmp_ret[1]; hiddenimports += tmp_ret[2]
13+
datas += copy_metadata('tgtg_scanner')
14+
15+
a = Analysis(
16+
['tgtg_scanner/__main__.py'],
17+
pathex=[],
18+
binaries=binaries,
19+
datas=datas,
20+
hiddenimports=hiddenimports,
21+
hookspath=[],
22+
hooksconfig={},
23+
runtime_hooks=[],
24+
excludes=[],
25+
win_no_prefer_redirects=False,
26+
win_private_assemblies=False,
27+
noarchive=False,
28+
optimize=0,
29+
)
30+
pyz = PYZ(a.pure)
31+
32+
exe = EXE(
33+
pyz,
34+
a.scripts,
35+
[],
36+
exclude_binaries=True,
37+
name='scanner',
38+
debug=False,
39+
bootloader_ignore_signals=True,
40+
strip=False,
41+
upx=True,
42+
console=True,
43+
disable_windowed_traceback=False,
44+
argv_emulation=False,
45+
target_arch=None,
46+
codesign_identity=None,
47+
entitlements_file=None,
48+
icon='icon.ico',
49+
)
50+
coll = COLLECT(
51+
exe,
52+
a.binaries,
53+
a.datas,
54+
strip=False,
55+
upx=True,
56+
upx_exclude=[],
57+
name='scanner',
58+
)

0 commit comments

Comments
 (0)