diff --git a/docs/conf.py b/docs/conf.py index 51afa1f63..134529b35 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -9,8 +9,8 @@ project = 'pyk' author = 'Runtime Verification, Inc' copyright = '2024, Runtime Verification, Inc' -version = '0.1.611' -release = '0.1.611' +version = '0.1.612' +release = '0.1.612' # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration diff --git a/package/version b/package/version index dcfeae5bb..4165da619 100644 --- a/package/version +++ b/package/version @@ -1 +1 @@ -0.1.611 +0.1.612 diff --git a/pyproject.toml b/pyproject.toml index 6ecd4f4c7..432ff416f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "pyk" -version = "0.1.611" +version = "0.1.612" description = "" authors = [ "Runtime Verification, Inc. ", diff --git a/src/pyk/utils.py b/src/pyk/utils.py index 2a7d7e09a..cffd16b0b 100644 --- a/src/pyk/utils.py +++ b/src/pyk/utils.py @@ -480,20 +480,17 @@ def abs_or_rel_to(path: Path, base: Path) -> Path: return base / path -class BugReport: +class BugReportBase: _bug_report: Path _command_id: int _defn_id: int _file_remap: dict[str, str] def __init__(self, bug_report: Path) -> None: - self._bug_report = bug_report.with_suffix('.tar') + self._bug_report = bug_report self._command_id = 0 self._defn_id = 0 self._file_remap = {} - if self._bug_report.exists(): - _LOGGER.warning(f'Bug report exists, removing: {self._bug_report}') - self._bug_report.unlink() def add_file(self, finput: Path, arcname: Path) -> None: if str(finput) not in self._file_remap: @@ -524,3 +521,26 @@ def _remap_arg(_a: str) -> str: shebang = '#!/usr/bin/env bash\nset -euxo pipefail\n' self.add_file_contents(shebang + ' '.join(remapped_args) + '\n', arcname) self._command_id += 1 + + +class BugReport(BugReportBase): + def __init__(self, bug_report: Path) -> None: + bug_report = bug_report.with_suffix('.tar') + if bug_report.exists(): + _LOGGER.warning(f'Bug report exists, removing: {bug_report}') + bug_report.unlink() + super().__init__(bug_report) + + def reporter(self, prefix: str) -> BugReportBase: + class BugReporter(BugReportBase): + _prefix: Path + + def __init__(self, bug_report: Path, prefix: Path) -> None: + super().__init__(bug_report) + self._prefix = prefix + + def add_file(self, finput: Path, arcname: Path) -> None: + arcname = self._prefix / arcname + super().add_file(finput, arcname) + + return BugReporter(self._bug_report, Path(prefix))