diff --git a/src/poetry/console/commands/install.py b/src/poetry/console/commands/install.py
index bedb292b587..1503d36520e 100644
--- a/src/poetry/console/commands/install.py
+++ b/src/poetry/console/commands/install.py
@@ -94,6 +94,18 @@ def _alternative_sync_command(self) -> str:
return "poetry sync"
def handle(self) -> int:
+ with_synchronization = self.option("sync")
+ if with_synchronization:
+ self.line_error(
+ "The `--sync>` option is"
+ " deprecated and slated for removal in the next minor release"
+ " after June 2025, use the"
+ f" `{self._alternative_sync_command}>`"
+ " command instead."
+ )
+ return self._handle(with_synchronization)
+
+ def _handle(self, with_synchronization: bool) -> int:
from poetry.core.masonry.utils.module import ModuleOrPackageNotFoundError
from poetry.masonry.builders.editable import EditableBuilder
@@ -150,16 +162,6 @@ def handle(self) -> int:
self.installer.extras(extras)
- with_synchronization = self.option("sync")
- if with_synchronization:
- self.line_error(
- "The `--sync>` option is"
- " deprecated and slated for removal in the next minor release"
- " after June 2025, use the"
- f" `{self._alternative_sync_command}>`"
- " command instead."
- )
-
self.installer.only_groups(self.activated_groups)
self.installer.skip_directory(self.option("no-directory"))
self.installer.dry_run(self.option("dry-run"))
diff --git a/src/poetry/console/commands/sync.py b/src/poetry/console/commands/sync.py
index 29d6c1be873..367c38d13e6 100644
--- a/src/poetry/console/commands/sync.py
+++ b/src/poetry/console/commands/sync.py
@@ -34,3 +34,6 @@ class SyncCommand(InstallCommand):
If you want to use Poetry only for dependency management but not for packaging,
you can set the "package-mode" to false in your pyproject.toml file.
"""
+
+ def handle(self) -> int:
+ return self._handle(True)