pyinstaller

This commit is contained in:
Christian Zangl 2024-01-12 22:33:59 +01:00
parent 51b5964224
commit 8552f13320
No known key found for this signature in database
GPG Key ID: 6D468AC36E2A4B3D
9 changed files with 50 additions and 4 deletions

View File

@ -7,6 +7,8 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: psf/black@stable

30
.github/workflows/pyinstaller.yml vendored Normal file
View File

@ -0,0 +1,30 @@
name: pyinstaller
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: prep
shell: bash
run: |
python -m pip install --upgrade pip
python -m pip install pipenv pyinstaller==6.3.0
pipenv install
rm -rf build dist
- name: build
shell: bash
run: |
pipenv --venv
pipenv run pyinstaller run.py --hidden-import chkbit --hidden-import chkbit_cli --onefile --name chkbit --console --paths $(pipenv --venv)/lib/*/site-packages
cat build/chkbit/warn-chkbit.txt
- name: artifact
uses: actions/upload-artifact@v3
with:
name: chkbit
path: dist/chkbit

2
.gitignore vendored
View File

@ -1,5 +1,7 @@
README.rst
build/
dist/
chkbit.spec
.cache/
.chkbit
.pytest_cache/

View File

@ -3,6 +3,7 @@ url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
# keep in sync with pyproject.toml
[packages]
blake3 = ">=0.3.4"

View File

@ -1,4 +1,5 @@
import hashlib
from blake3 import blake3
from typing import Callable
@ -11,8 +12,6 @@ def hashfile(path: str, hash_algo: str, *, hit: Callable[[str], None]):
elif hash_algo == "sha512":
h = hashlib.sha512()
elif hash_algo == "blake3":
from blake3 import blake3
h = blake3()
else:
raise Exception(f"algo '{hash_algo}' is unknown.")

5
chkbit_cli/__init__.py Normal file
View File

@ -0,0 +1,5 @@
from chkbit_cli.cli import CLI
from chkbit_cli.progress import Progress
from chkbit_cli.sparklines import sparkify
from chkbit_cli.rate_calc import RateCalc
from chkbit_cli.main import Main, main

View File

@ -5,6 +5,8 @@ description = "chkbit checks the data integrity of your files"
authors = [
{name = "Christian Zangl", email = "laktak@cdak.net"},
]
# keep in sync with Pipfile
dependencies = [
"blake3>=0.3.4",
]

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
blake3>=0.3.4

4
run.py Normal file
View File

@ -0,0 +1,4 @@
from chkbit_cli import main
if __name__ == "__main__":
main()