Skip to content

Commit

Permalink
fix sync command
Browse files Browse the repository at this point in the history
  • Loading branch information
trim21 committed Jan 5, 2025
1 parent fc2faeb commit 49c161d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/poetry/console/commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
"<warning>The `<fg=yellow;options=bold>--sync</>` option is"
" deprecated and slated for removal in the next minor release"
" after June 2025, use the"
f" `<fg=yellow;options=bold>{self._alternative_sync_command}</>`"
" command instead.</warning>"
)
return self._handle_install(with_synchronization)

def _handle_install(self, with_synchronization: bool) -> int:
from poetry.core.masonry.utils.module import ModuleOrPackageNotFoundError

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

self.installer.extras(extras)

with_synchronization = self.option("sync")
if with_synchronization:
self.line_error(
"<warning>The `<fg=yellow;options=bold>--sync</>` option is"
" deprecated and slated for removal in the next minor release"
" after June 2025, use the"
f" `<fg=yellow;options=bold>{self._alternative_sync_command}</>`"
" command instead.</warning>"
)

self.installer.only_groups(self.activated_groups)
self.installer.skip_directory(self.option("no-directory"))
self.installer.dry_run(self.option("dry-run"))
Expand Down
3 changes: 3 additions & 0 deletions src/poetry/console/commands/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_install(True)

0 comments on commit 49c161d

Please sign in to comment.