From 1b7c707a2cf39b96394a076f1e0426893c99e6a1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 15 May 2026 08:55:52 +0000 Subject: [PATCH 1/4] Initial plan From 888d65fed4874514d20a81999200b138ed15ee65 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 15 May 2026 09:01:51 +0000 Subject: [PATCH 2/4] Fix PyInstaller args and add Linux build integration test Agent-Logs-Url: https://github.com/RaymondSu-Public-Base/Vibe-helloworld-python/sessions/9b755e5d-ab7f-4985-90af-4908c17bff38 Co-authored-by: RaymondSu-Public-Base <29174601+RaymondSu-Public-Base@users.noreply.github.com> --- src/hello_python/build.py | 4 ++-- tests/test_build.py | 37 +++++++++++++++++++++++++++++++++++-- tests/test_build_class.py | 4 ++-- 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/src/hello_python/build.py b/src/hello_python/build.py index 3368ad8..bdeeec4 100644 --- a/src/hello_python/build.py +++ b/src/hello_python/build.py @@ -52,8 +52,8 @@ def build(self) -> Path: "--clean", "--onefile", "--windowed", - "--hidden-import", - "PyQt5.sip", + "--collect-all", + "PyQt5", "--name", self.name, "--distpath", diff --git a/tests/test_build.py b/tests/test_build.py index 2da74fa..c9b4666 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -87,8 +87,8 @@ def test_build_windows_executable(self, tmp_path: Path) -> None: "--clean", "--onefile", "--windowed", - "--hidden-import", - "PyQt5.sip", + "--collect-all", + "PyQt5", "--name", "hello-python-windows", "--distpath", @@ -107,3 +107,36 @@ def test_build_windows_executable(self, tmp_path: Path) -> None: exe = dist_path / "hello-python-windows.exe" assert exe.is_file(), "Executable not produced" assert exe.stat().st_size > 0, "Executable is empty" + + @pytest.mark.skipif(platform.system() != "Linux", reason="Linux-only build test") + def test_build_linux_executable(self, tmp_path: Path) -> None: + dist_path = tmp_path / "dist" / "linux" + result = subprocess.run( + [ + sys.executable, + "-m", + "PyInstaller", + "--noconfirm", + "--clean", + "--onefile", + "--windowed", + "--collect-all", + "PyQt5", + "--name", + "hello-python-linux", + "--distpath", + str(dist_path), + "--workpath", + str(tmp_path / "build"), + "--specpath", + str(tmp_path / "spec"), + str(ROOT_DIR / "src" / "hello_python" / "main.py"), + ], + capture_output=True, + text=True, + cwd=str(ROOT_DIR), + ) + assert result.returncode == 0, f"Build failed:\n{result.stderr}" + exe = dist_path / "hello-python-linux" + assert exe.is_file(), "Executable not produced" + assert exe.stat().st_size > 0, "Executable is empty" diff --git a/tests/test_build_class.py b/tests/test_build_class.py index 2408147..40c9356 100644 --- a/tests/test_build_class.py +++ b/tests/test_build_class.py @@ -132,8 +132,8 @@ def test_build_invokes_pyinstaller_with_correct_args( assert "--clean" in cmd assert "--onefile" in cmd assert "--windowed" in cmd - assert "--hidden-import" in cmd - assert "PyQt5.sip" in cmd + assert "--collect-all" in cmd + assert "PyQt5" in cmd assert str(builder.entry_point) in cmd @patch("hello_python.build.subprocess.run") From 5aae9489e5dd130e18761ed1030bf6ee6394a534 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 15 May 2026 09:03:59 +0000 Subject: [PATCH 3/4] Add explicit slow marker to Linux build integration test Agent-Logs-Url: https://github.com/RaymondSu-Public-Base/Vibe-helloworld-python/sessions/9b755e5d-ab7f-4985-90af-4908c17bff38 Co-authored-by: RaymondSu-Public-Base <29174601+RaymondSu-Public-Base@users.noreply.github.com> --- tests/test_build.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_build.py b/tests/test_build.py index c9b4666..db5aae5 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -108,6 +108,7 @@ def test_build_windows_executable(self, tmp_path: Path) -> None: assert exe.is_file(), "Executable not produced" assert exe.stat().st_size > 0, "Executable is empty" + @pytest.mark.slow @pytest.mark.skipif(platform.system() != "Linux", reason="Linux-only build test") def test_build_linux_executable(self, tmp_path: Path) -> None: dist_path = tmp_path / "dist" / "linux" From 1dd7de7fb0d0da761f2a3df5d4d51a2c2a64a2a7 Mon Sep 17 00:00:00 2001 From: v-raymondsu Date: Mon, 18 May 2026 16:34:57 +0800 Subject: [PATCH 4/4] fix: copilot solution caused windows application control policy error: cannot call python dll outside .exe - Replaced build param --onefile by --onedir --- src/hello_python/build.py | 6 +++--- tests/test_build.py | 8 ++++---- tests/test_build_class.py | 10 +++++++--- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/hello_python/build.py b/src/hello_python/build.py index bdeeec4..d68331c 100644 --- a/src/hello_python/build.py +++ b/src/hello_python/build.py @@ -50,7 +50,7 @@ def build(self) -> Path: "pyinstaller", "--noconfirm", "--clean", - "--onefile", + "--onedir", "--windowed", "--collect-all", "PyQt5", @@ -69,9 +69,9 @@ def build(self) -> Path: raise RuntimeError(f"Build failed with exit code {result.returncode}") if platform.system() == "Windows": - exe = self.dist_path / f"{self.name}.exe" + exe = self.dist_path / self.name / f"{self.name}.exe" else: - exe = self.dist_path / self.name + exe = self.dist_path / self.name / self.name print(f"Built executable: {exe}") return exe diff --git a/tests/test_build.py b/tests/test_build.py index db5aae5..f0f4f24 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -85,7 +85,7 @@ def test_build_windows_executable(self, tmp_path: Path) -> None: "PyInstaller", "--noconfirm", "--clean", - "--onefile", + "--onedir", "--windowed", "--collect-all", "PyQt5", @@ -104,7 +104,7 @@ def test_build_windows_executable(self, tmp_path: Path) -> None: cwd=str(ROOT_DIR), ) assert result.returncode == 0, f"Build failed:\n{result.stderr}" - exe = dist_path / "hello-python-windows.exe" + exe = dist_path / "hello-python-windows" / "hello-python-windows.exe" assert exe.is_file(), "Executable not produced" assert exe.stat().st_size > 0, "Executable is empty" @@ -119,7 +119,7 @@ def test_build_linux_executable(self, tmp_path: Path) -> None: "PyInstaller", "--noconfirm", "--clean", - "--onefile", + "--onedir", "--windowed", "--collect-all", "PyQt5", @@ -138,6 +138,6 @@ def test_build_linux_executable(self, tmp_path: Path) -> None: cwd=str(ROOT_DIR), ) assert result.returncode == 0, f"Build failed:\n{result.stderr}" - exe = dist_path / "hello-python-linux" + exe = dist_path / "hello-python-linux" / "hello-python-linux" assert exe.is_file(), "Executable not produced" assert exe.stat().st_size > 0, "Executable is empty" diff --git a/tests/test_build_class.py b/tests/test_build_class.py index 40c9356..16f8f5c 100644 --- a/tests/test_build_class.py +++ b/tests/test_build_class.py @@ -115,9 +115,13 @@ def test_build_invokes_pyinstaller_with_correct_args( builder = BuildExecutable(root_dir=tmp_path) builder.dist_path.mkdir(parents=True) if platform.system() == "Windows": - exe = builder.dist_path / f"{builder.name}.exe" + exe_dir = builder.dist_path / builder.name + exe_dir.mkdir(parents=True) + exe = exe_dir / f"{builder.name}.exe" else: - exe = builder.dist_path / builder.name + exe_dir = builder.dist_path / builder.name + exe_dir.mkdir(parents=True) + exe = exe_dir / builder.name exe.touch() result = builder.build() @@ -130,7 +134,7 @@ def test_build_invokes_pyinstaller_with_correct_args( assert "pyinstaller" in cmd assert "--noconfirm" in cmd assert "--clean" in cmd - assert "--onefile" in cmd + assert "--onedir" in cmd assert "--windowed" in cmd assert "--collect-all" in cmd assert "PyQt5" in cmd