Skip to content

Commit

Permalink
fix(build): include omitted lib dir
Browse files Browse the repository at this point in the history
When packaging the Ruby Pact binaries, I initially removed the `lib` dir
naively believing that the Pact binaries were static. This is in fact
incorrect, and I adjusted the extraction to extract _all_ of the
content (and only remove the README.md).

The unit tests all passed which affirmed my initial belief.
Unfortunately (as I have now discovered), the unit tests mock out the
call to the binaries, and therefore the test suite did not actuall test
the execution of the binaries.

Signed-off-by: JP-Ellis <josh@jpellis.me>
  • Loading branch information
JP-Ellis committed Oct 12, 2023
1 parent 2b269b5 commit 6e9db03
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions hatch_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,19 +169,16 @@ def _pact_bin_extract(self, artifact: Path) -> None:
Args:
artifact: The path to the downloaded artifact.
"""
(ROOT_DIR / "pact" / "bin").mkdir(parents=True, exist_ok=True)

if str(artifact).endswith(".zip"):
with zipfile.ZipFile(artifact) as f:
for member in f.namelist():
if member.startswith("pact/bin"):
f.extract(member, ROOT_DIR)
f.extractall(ROOT_DIR)

if str(artifact).endswith(".tar.gz"):
with tarfile.open(artifact) as f:
for member in f.getmembers():
if member.name.startswith("pact/bin"):
f.extract(member, ROOT_DIR)
f.extractall(ROOT_DIR)

# Cleanup the extract `README.md`
(ROOT_DIR / "pact" / "README.md").unlink()

def pact_lib_install(self, version: str) -> None:
"""
Expand Down

0 comments on commit 6e9db03

Please sign in to comment.