Skip to content

Commit

Permalink
Merge pull request #494 from Der-Henning/pyinstaller_av
Browse files Browse the repository at this point in the history
switch to pyinstaller onefolder
  • Loading branch information
Der-Henning authored May 19, 2024
2 parents ca678e7 + 5f2ab4b commit dcc0f2b
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 25 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,22 @@ jobs:
poetry-version: ${{ env.POETRY_VERSION }}
python-version: ${{ env.PYTHON_VERSION }}
without: test
- name: Run PyInstaller
- name: Run PyInstaller (linux/macos)
if: matrix.tag == 'linux' || matrix.tag == 'macos'
run: |
poetry run pyinstaller scanner.spec
cp ./config.sample.ini ./dist/config.ini
cp ./README.md ./dist/README.md
cp ./LICENSE ./dist/LICENSE
./dist/scanner -v
- name: Run PyInstaller (win)
if: matrix.tag == 'win'
run: |
poetry run pyinstaller scanner_win.spec
cp ./config.sample.ini ./dist/scanner/config.ini
cp ./README.md ./dist/scanner/README.md
cp ./LICENSE ./dist/scanner/LICENSE
./dist/scanner/scanner -v
- name: Make filename for archive
id: filename
shell: bash
Expand All @@ -124,7 +133,7 @@ jobs:
run: zip -j ./${{ steps.filename.outputs.FILENAME }} ./dist/*
- name: Zip files (win)
if: matrix.tag == 'win'
run: Compress-Archive ./dist/* ./${{ steps.filename.outputs.FILENAME }}
run: Compress-Archive ./dist/scanner/* ./${{ steps.filename.outputs.FILENAME }}
- name: Upload archive
uses: actions/upload-artifact@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ tox:
executable:
rm -rf ./build ./dist
poetry run pyinstaller ./scanner.spec
cp ./config.sample.ini ./dist/config.ini
zip -j ./dist/scanner.zip ./dist/*
cp ./config.sample.ini ./dist/scanner/config.ini
cd ./dist/scanner; zip -r ../scanner.zip *

images:
docker build -f ./docker/Dockerfile -t tgtg-scanner:latest .
Expand Down
38 changes: 19 additions & 19 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
aiohttp==3.9.5 ; python_version >= "3.9" and python_version < "3.13"
aiosignal==1.3.1 ; python_version >= "3.9" and python_version < "3.13"
anyio==4.3.0 ; python_version >= "3.9" and python_version < "3.13"
apprise==1.7.6 ; python_version >= "3.9" and python_version < "3.13"
apprise==1.8.0 ; python_version >= "3.9" and python_version < "3.13"
async-timeout==4.0.3 ; python_version >= "3.9" and python_version < "3.11"
attrs==23.2.0 ; python_version >= "3.9" and python_version < "3.13"
cachetools==5.3.3 ; python_version >= "3.9" and python_version < "3.13"
Expand Down Expand Up @@ -38,4 +38,4 @@ sniffio==1.3.1 ; python_version >= "3.9" and python_version < "3.13"
typing-extensions==4.11.0 ; python_version >= "3.9" and python_version < "3.11"
urllib3==2.2.1 ; python_version >= "3.9" and python_version < "3.13"
yarl==1.9.4 ; python_version >= "3.9" and python_version < "3.13"
zipp==3.18.1 ; python_version >= "3.9" and python_version < "3.10"
zipp==3.18.2 ; python_version >= "3.9" and python_version < "3.10"
58 changes: 58 additions & 0 deletions scanner_win.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# -*- mode: python ; coding: utf-8 -*-
from PyInstaller.utils.hooks import collect_all, copy_metadata

datas = []
binaries = []
hiddenimports = []
tmp_ret = collect_all('apprise')
datas += tmp_ret[0]; binaries += tmp_ret[1]; hiddenimports += tmp_ret[2]
tmp_ret = collect_all('humanize')
datas += tmp_ret[0]; binaries += tmp_ret[1]; hiddenimports += tmp_ret[2]
tmp_ret = collect_all('cron_descriptor')
datas += tmp_ret[0]; binaries += tmp_ret[1]; hiddenimports += tmp_ret[2]
datas += copy_metadata('tgtg_scanner')

a = Analysis(
['tgtg_scanner/__main__.py'],
pathex=[],
binaries=binaries,
datas=datas,
hiddenimports=hiddenimports,
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
noarchive=False,
optimize=0,
)
pyz = PYZ(a.pure)

exe = EXE(
pyz,
a.scripts,
[],
exclude_binaries=True,
name='scanner',
debug=False,
bootloader_ignore_signals=True,
strip=False,
upx=True,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
icon='icon.ico',
)
coll = COLLECT(
exe,
a.binaries,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='scanner',
)

0 comments on commit dcc0f2b

Please sign in to comment.