From c4d85365091d2e8c93384f238d78b7cee2462a8b Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Wed, 19 Aug 2026 07:50:19 -0400 Subject: [PATCH] =?UTF-8?q?[FIX]=20script=20todo:=20ouvrir=20PyCharm=20apr?= =?UTF-8?q?=C3=A8s=20l'installation,=20pas=20avant?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit « ⚠ pas de .idea » à chaque installation : PyCharm ouvrait un dépôt cloné mais pas installé, son configurateur d'interpréteur Python échouait faute de venv, et il renonçait avant d'écrire quoi que ce soit. Le même appel sur un dépôt installé écrit erplibre.iml, misc.xml, modules.xml et vcs.xml en cinq minutes — mesuré sur la VM. L'ouverture passe donc après le make, et « make pycharm_configure » la suit : pycharm_update() s'était déjà exécuté pendant l'installation, quand il n'y avait rien à configurer. Le groupe rend toujours 0 — un bonus ne rougit pas une VM — et la phase mobile, qui porte le verdict, reste après lui. --- EN --- "⚠ no .idea" on every install: PyCharm was opening a repo that was cloned but not installed, its Python interpreter configurator failed for lack of a venv, and it gave up before writing anything. The same call on an installed repo writes erplibre.iml, misc.xml, modules.xml and vcs.xml in five minutes — measured on the VM. The open therefore moves after the make, with "make pycharm_configure" behind it: pycharm_update() had already run during the install, when there was nothing to configure. The group always returns 0 — a bonus does not redden a VM — and the mobile phase, which carries the verdict, still comes after it. Assisted-by: Claude Opus 5 --- script/todo/todo.py | 30 ++++++++++++++++++++++-------- test/test_qemu_desktop_tools.py | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 52 insertions(+), 10 deletions(-) diff --git a/script/todo/todo.py b/script/todo/todo.py index 907f39f..33cab8c 100755 --- a/script/todo/todo.py +++ b/script/todo/todo.py @@ -6657,14 +6657,30 @@ class TODO: # « make install_os » installe. Liée par « && » et NON gardée, pour que # son échec soit celui de la VM. after_cmd = self._qemu_tools_remote_cmd(tools, prod, "after") - # Entre le clone et le make : PyCharm ouvre le dépôt une fois pour en - # écrire le .idea, que l'installation configurera juste après. Le - # groupe rend toujours 0 — l'étape est un bonus, pas une condition. + # APRÈS le make, et c'est mesuré : sur un dépôt cloné mais pas installé, + # PyCharm n'écrit AUCUN .idea — son configurateur d'interpréteur Python + # échoue faute de venv, et il renonce. « ⚠ pas de .idea », deux fois de + # suite sur erplibre-ubuntu-2604-gnome. Le même appel sur un dépôt + # installé l'écrit en cinq minutes : erplibre.iml, misc.xml, + # modules.xml, vcs.xml. + # + # On ouvre donc quand l'interpréteur existe, puis on demande la + # configuration explicitement : l'installation est déjà passée, et + # pycharm_update() n'avait alors rien à configurer. open_step = ( - f"{{ {self._qemu_pycharm_project_cmd(prod)} }} && " + self._qemu_pycharm_project_cmd(prod) + + "make pycharm_configure || true; " if "pycharm" in (tools or ()) else "" ) + # Le groupe de PyCharm rend toujours 0 — un bonus, pas une condition — + # là où la phase mobile porte le verdict de la VM. + chain = [final_cmd] + if open_step: + chain.append(f"{{ {open_step} }}") + if after_cmd: + chain.append(f"{{ {after_cmd} }}") + install_chain = " && ".join(chain) return ( "set -e; " + self._qemu_cloud_init_wait() # Coupé AVANT les apt-get ci-dessous : sinon apt-daily peut reprendre @@ -6774,8 +6790,7 @@ class TODO: f"sudo git clone --branch {shlex.quote(branch)} " f"{self.ERPLIBRE_GIT_URL} /opt/erplibre; " "sudo chown -R $(id -un):$(id -gn) /opt/erplibre; fi; " - f"cd /opt/erplibre && {open_step}{final_cmd}" - + (f" && {{ {after_cmd} }}" if after_cmd else "") + f"cd /opt/erplibre && {install_chain}" ) if prod else ( @@ -6783,8 +6798,7 @@ class TODO: "if [ ! -d ~/git/erplibre/.git ]; then " f"git clone --branch {shlex.quote(branch)} " f"{self.ERPLIBRE_GIT_URL} ~/git/erplibre; fi; " - f"cd ~/git/erplibre && {open_step}{final_cmd}" - + (f" && {{ {after_cmd} }}" if after_cmd else "") + f"cd ~/git/erplibre && {install_chain}" ) ) ) diff --git a/test/test_qemu_desktop_tools.py b/test/test_qemu_desktop_tools.py index 2686849..230b0ec 100644 --- a/test/test_qemu_desktop_tools.py +++ b/test/test_qemu_desktop_tools.py @@ -627,13 +627,41 @@ class TestPycharmFirstOpen(unittest.TestCase): self.todo = TODO.__new__(TODO) self.cmd = self.todo._qemu_pycharm_project_cmd() - def test_it_runs_between_the_clone_and_the_make(self): + def test_it_runs_after_the_install_not_before(self): + """Mesuré : sur un dépôt cloné mais pas installé, PyCharm n'écrit AUCUN + .idea — son configurateur d'interpréteur échoue faute de venv, et il + renonce (« ⚠ pas de .idea », deux fois sur une VM réelle). Le même appel + sur un dépôt installé l'écrit en cinq minutes.""" script = self.todo._qemu_erplibre_remote_cmd( "develop", None, False, "gnome", "", "deb", ("pycharm",) ) self.assertLess(script.index("git clone"), script.index("xvfb-run")) self.assertLess( - script.index("xvfb-run"), script.index("make install_os") + script.index("make install_os"), script.index("xvfb-run") + ) + + def test_the_configuration_is_asked_for_after_the_open(self): + """L'installation est déjà passée quand le .idea naît : pycharm_update() + n'avait rien à configurer, donc on le demande explicitement.""" + script = self.todo._qemu_erplibre_remote_cmd( + "develop", None, False, "gnome", "", "deb", ("pycharm",) + ) + self.assertIn("make pycharm_configure", script) + self.assertLess( + script.index("xvfb-run"), script.index("make pycharm_configure") + ) + + def test_it_never_decides_the_verdict_of_the_vm(self): + """Un bonus : ni son échec ni celui de sa configuration ne doivent + rougir une VM dont tout le reste a réussi. La phase mobile, elle, porte + bien le verdict — et elle vient après.""" + script = self.todo._qemu_erplibre_remote_cmd( + "develop", None, False, "gnome", "", "deb", ("pycharm", "mobile") + ) + self.assertIn("make pycharm_configure || true", script) + self.assertLess( + script.index("make pycharm_configure"), + script.index("ERPLibre mobile"), ) def test_only_when_pycharm_was_asked_for(self):