Skip to content

Commit

Permalink
Install kaitai-struct-compiler to build in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ESultanik committed May 13, 2021
1 parent ac9590e commit d6fcc07
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion polyfile/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
12 changes: 10 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit d6fcc07

Please sign in to comment.