Skip to content

Commit 49c161d

Browse files
committed
fix sync command
1 parent fc2faeb commit 49c161d

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

src/poetry/console/commands/install.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,18 @@ def _alternative_sync_command(self) -> str:
9494
return "poetry sync"
9595

9696
def handle(self) -> int:
97+
with_synchronization = self.option("sync")
98+
if with_synchronization:
99+
self.line_error(
100+
"<warning>The `<fg=yellow;options=bold>--sync</>` option is"
101+
" deprecated and slated for removal in the next minor release"
102+
" after June 2025, use the"
103+
f" `<fg=yellow;options=bold>{self._alternative_sync_command}</>`"
104+
" command instead.</warning>"
105+
)
106+
return self._handle_install(with_synchronization)
107+
108+
def _handle_install(self, with_synchronization: bool) -> int:
97109
from poetry.core.masonry.utils.module import ModuleOrPackageNotFoundError
98110

99111
from poetry.masonry.builders.editable import EditableBuilder
@@ -150,16 +162,6 @@ def handle(self) -> int:
150162

151163
self.installer.extras(extras)
152164

153-
with_synchronization = self.option("sync")
154-
if with_synchronization:
155-
self.line_error(
156-
"<warning>The `<fg=yellow;options=bold>--sync</>` option is"
157-
" deprecated and slated for removal in the next minor release"
158-
" after June 2025, use the"
159-
f" `<fg=yellow;options=bold>{self._alternative_sync_command}</>`"
160-
" command instead.</warning>"
161-
)
162-
163165
self.installer.only_groups(self.activated_groups)
164166
self.installer.skip_directory(self.option("no-directory"))
165167
self.installer.dry_run(self.option("dry-run"))

src/poetry/console/commands/sync.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ class SyncCommand(InstallCommand):
3434
If you want to use Poetry only for dependency management but not for packaging,
3535
you can set the "package-mode" to false in your pyproject.toml file.
3636
"""
37+
38+
def handle(self) -> int:
39+
return self._handle_install(True)

0 commit comments

Comments
 (0)