Repository navigation
Keep the 7-Zip cache archive when 7-Zip only warns #321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -222,7 +222,8 @@ def build_tarball(self) -> None: | |||||||
| ] | ||||||||
| cmd += ["-xr!" + pattern.replace("/", "\\") for pattern in ARCHIVE_EXCLUDES] | ||||||||
| return_status: int = self.echo_check_call(cmd) | ||||||||
| if return_status == 0: | ||||||||
| # 1 is a warning, such as a file another process holds open. | ||||||||
| if return_status in (0, 1): | ||||||||
|
Comment on lines
+225
to
+226
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should-fix: with
Suggested change
If you'd still rather keep a warned archive, print the skipped paths from the captured output first, so the log says which files are missing (see the review body). |
||||||||
| return | ||||||||
|
|
||||||||
| if out_zip.exists(): | ||||||||
|
|
||||||||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -210,7 +210,7 @@ def test_repaired_wheel_replaces_the_input_in_place( | |||||||
|
|
||||||||
|
|
||||||||
| def _run_build_tarball( | ||||||||
| windows_builder: WindowsBuildPythonInstance, tmp_path: Path | ||||||||
| windows_builder: WindowsBuildPythonInstance, tmp_path: Path, status: int = 0 | ||||||||
| ) -> list[str]: | ||||||||
| """Drive ``build_tarball`` down the 7-Zip branch and return the command.""" | ||||||||
| windows_builder.ipp_dir = tmp_path / "IPP" | ||||||||
|
|
@@ -219,7 +219,7 @@ def _run_build_tarball( | |||||||
|
|
||||||||
| def fake_call(cmd: Sequence[object], *args: object, **kwargs: object) -> int: | ||||||||
| captured["cmd"] = [str(c) for c in cmd] | ||||||||
| return 0 | ||||||||
| return status | ||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should-fix: the fake never writes the archive, so the test below can't tell "kept" from "never written". Have it write a marker so the test can check that the archive survives:
Suggested change
|
||||||||
|
|
||||||||
| with ( | ||||||||
| patch("windows_build_python_instance.shutil.which", return_value="/fake/7z"), | ||||||||
|
|
@@ -272,6 +272,14 @@ def test_seven_zip_starts_a_new_archive( | |||||||
| assert not stale.exists() | ||||||||
|
|
||||||||
|
|
||||||||
| def test_seven_zip_warnings_keep_its_archive( | ||||||||
| tmp_path: Path, windows_builder: WindowsBuildPythonInstance | ||||||||
| ) -> None: | ||||||||
| """Exit code 1 (e.g. a locked log file) must not start the zip fallback.""" | ||||||||
| _run_build_tarball(windows_builder, tmp_path, status=1) | ||||||||
| assert not (windows_builder.build_dir_root / "ITKPythonBuilds-windows.zip").exists() | ||||||||
|
Comment on lines
+275
to
+280
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should-fix: as written, this asserts the archive does not exist, the opposite of its name. With the marker above, assert the bytes survive at status 0. Add a test that status 1 and 2 (or 1 alone, if you take the |
||||||||
|
|
||||||||
|
|
||||||||
| def test_zip_fallback_archives_the_seven_zip_roots( | ||||||||
| tmp_path: Path, windows_builder: WindowsBuildPythonInstance | ||||||||
| ) -> None: | ||||||||
|
|
||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should-fix: include files held open for writing, which fixes the
run2.logcase without accepting other warnings.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be explicit about my preference: I'd rather take
-sswthan accept exit code 1.-sswfixes the open-log case directly, and keeping== 0means any other warning (a locked build file, a missing root) still reaches the fallback rather than publishing an incomplete cache.