Skip to content

Commit 99f7657

Browse files
committed
fix(build): include omitted lib dir
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>
1 parent ac50ca7 commit 99f7657

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

hatch_build.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -169,19 +169,16 @@ def _pact_bin_extract(self, artifact: Path) -> None:
169169
Args:
170170
artifact: The path to the downloaded artifact.
171171
"""
172-
(ROOT_DIR / "pact" / "bin").mkdir(parents=True, exist_ok=True)
173-
174172
if str(artifact).endswith(".zip"):
175173
with zipfile.ZipFile(artifact) as f:
176-
for member in f.namelist():
177-
if member.startswith("pact/bin"):
178-
f.extract(member, ROOT_DIR)
174+
f.extractall(ROOT_DIR)
179175

180176
if str(artifact).endswith(".tar.gz"):
181177
with tarfile.open(artifact) as f:
182-
for member in f.getmembers():
183-
if member.name.startswith("pact/bin"):
184-
f.extract(member, ROOT_DIR)
178+
f.extractall(ROOT_DIR)
179+
180+
# Cleanup the extract `README.md`
181+
(ROOT_DIR / "pact" / "README.md").unlink()
185182

186183
def pact_lib_install(self, version: str) -> None:
187184
"""

0 commit comments

Comments
 (0)