diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pythonpublish.yml index edc61330..992b05a6 100644 --- a/.github/workflows/pythonpublish.yml +++ b/.github/workflows/pythonpublish.yml @@ -22,6 +22,8 @@ jobs: python-version: '3.x' - name: Install dependencies run: | + curl -LO https://github.com/kaitai-io/kaitai_struct_compiler/releases/download/0.9/kaitai-struct-compiler_0.9_all.deb + sudo apt-get install ./kaitai-struct-compiler_0.9_all.deb python -m pip install --upgrade pip pip install setuptools wheel twine - name: Build and publish diff --git a/polyfile/version.py b/polyfile/version.py index c6d84c5a..ce9c4283 100644 --- a/polyfile/version.py +++ b/polyfile/version.py @@ -19,7 +19,7 @@ def git_branch(): DEV_BUILD = False -__version__ = (0, 3, 0) +__version__ = (0, 3, 1) if DEV_BUILD: branch_name = git_branch() diff --git a/setup.py b/setup.py index 18c4b672..44413cdb 100644 --- a/setup.py +++ b/setup.py @@ -1,9 +1,11 @@ import concurrent.futures import json +import shutil from multiprocessing import cpu_count import os from pathlib import Path from setuptools import setup, find_packages +from shutil import which import subprocess import sys from typing import Any, Dict, List, Optional, Tuple @@ -47,6 +49,10 @@ def compile_ksy(path: Path) -> List[Tuple[str, str]]: if not MANIFEST_PATH.exists() or newest_definition > MANIFEST_PATH.stat().st_mtime: # the definitions have been updated, so we need to recompile everything + if shutil.which("kaitai-struct-compiler") is None: + sys.stderr.write("Error: You must have kaitai-struct-compiler installed") + sys.exit(1) + num_files = sum(1 for _ in KAITAI_FORMAT_LIBRARY.glob("**/*.ksy")) try: @@ -56,17 +62,19 @@ def tqdm(*args, **kwargs): class TQDM: def __enter__(self): return self + def __exit__(self, exc_type, exc_val, exc_tb): pass - def write(self, message, *args, **kwargs): + + def write(self, message, *_, **__): sys.stderr.write(message) sys.stderr.write("\n") sys.stderr.flush() + def update(self, n: int): pass return TQDM() - ksy_manifest: Dict[str, Dict[str, Any]] = {} with tqdm(leave=False, desc="Compiling the Kaitai Struct Format Library", total=num_files) as t: