Loading poetry/console/application.py +2 −0 Changes for poetry/console/application.py: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ from poetry.utils.venv import Venv from .commands import AboutCommand from .commands import InstallCommand from .commands import LockCommand from .commands import UpdateCommand class Application(BaseApplication): Loading Loading @@ -38,6 +39,7 @@ class Application(BaseApplication): AboutCommand(), InstallCommand(), LockCommand(), UpdateCommand(), ] def do_run(self, i, o) -> int: Loading poetry/console/commands/__init__.py +1 −0 Changes for poetry/console/commands/__init__.py: 1 added line, 0 removed lines. Original line number Diff line number Diff line from .about import AboutCommand from .install import InstallCommand from .lock import LockCommand from .update import UpdateCommand poetry/console/commands/install.py +1 −0 Changes for poetry/console/commands/install.py: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -31,5 +31,6 @@ exist it will look for <comment>poetry.toml</> and do the same. ) installer.dev_mode(not self.option('no-dev')) installer.dry_run(self.option('dry-run')) return installer.run() poetry/console/commands/update.py 0 → 100644 +33 −0 Changes for poetry/console/commands/update.py: 33 added lines, 0 removed lines. Original line number Diff line number Diff line from poetry.installation import Installer from poetry.repositories.pypi_repository import PyPiRepository from .command import Command class UpdateCommand(Command): """ Update dependencies as according to the <comment>poetry.toml</> file. update { packages?* : The packages to update. } { --f|features=* : Features to install. } { --no-dev : Do not install dev dependencies. } { --dry-run : Outputs the operations but will not execute anything (implicitly enables --verbose). } """ def handle(self): installer = Installer( self.output, self.poetry.package, self.poetry.locker, PyPiRepository() ) installer.dev_mode(not self.option('no-dev')) installer.dry_run(self.option('dry-run')) # Force update installer.update(True) return installer.run() poetry/installation/installer.py +33 −9 Changes for poetry/installation/installer.py: 33 added lines, 9 removed lines. Original line number Diff line number Diff line Loading @@ -98,18 +98,18 @@ class Installer: def _do_install(self, local_repo): locked_repository = Repository() # initialize locked repo if we are installing from lock if not self._update: if not self._update or self._locker.is_locked(): locked_repository = self._locker.locked_repository(self._dev_mode) if self._update: self._io.writeln('<info>Updating dependencies</>') solver = Solver(locked_repository, self._io) request = self._package.requires if self.is_dev_mode(): request += self._package.dev_requires if self._update: self._io.writeln('<info>Updating dependencies</>') ops = solver.solve(request, self._repository) else: self._io.writeln('<info>Installing dependencies from lock file</>') Loading @@ -130,7 +130,7 @@ class Installer: # if they are present in the local repo # TODO if ops and self._execute_operations: if ops and (self._execute_operations or self._dry_run): installs = [] updates = [] uninstalls = [] Loading Loading @@ -166,7 +166,6 @@ class Installer: elif op.job_type == 'update': local_repo.add_package(op.target_package) if self._execute_operations: self._execute(op) def _execute(self, operation: Operation) -> None: Loading @@ -178,15 +177,40 @@ class Installer: getattr(self, f'_execute_{method}')(operation) def _execute_install(self, operation: Install) -> None: self._io.writeln( f' - Installing <info>{operation.package.name}</> ' f'(<comment>{operation.package.full_pretty_version}</>)' ) if not self._execute_operations: return self._installer.install(operation.package) def _execute_update(self, operation: Update) -> None: self._installer.update( operation.initial_package, operation.target_package source = operation.target_package target = operation.target_package self._io.writeln( f' - Updating <info>{target.name}</> ' f'(<comment>{source.pretty_version}</>' f' -> <comment>{target.pretty_version}</>)' ) if not self._execute_operations: return self._installer.update(source, target) def _execute_uninstall(self, operation: Uninstall) -> None: self._io.writeln( f' - Removing <info>{operation.package.name}</> ' f'(<comment>{operation.package.full_pretty_version}</>)' ) if not self._execute_operations: return self._installer.remove(operation.package) def _get_operations_from_lock(self, Loading Loading
poetry/console/application.py +2 −0 Changes for poetry/console/application.py: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ from poetry.utils.venv import Venv from .commands import AboutCommand from .commands import InstallCommand from .commands import LockCommand from .commands import UpdateCommand class Application(BaseApplication): Loading Loading @@ -38,6 +39,7 @@ class Application(BaseApplication): AboutCommand(), InstallCommand(), LockCommand(), UpdateCommand(), ] def do_run(self, i, o) -> int: Loading
poetry/console/commands/__init__.py +1 −0 Changes for poetry/console/commands/__init__.py: 1 added line, 0 removed lines. Original line number Diff line number Diff line from .about import AboutCommand from .install import InstallCommand from .lock import LockCommand from .update import UpdateCommand
poetry/console/commands/install.py +1 −0 Changes for poetry/console/commands/install.py: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -31,5 +31,6 @@ exist it will look for <comment>poetry.toml</> and do the same. ) installer.dev_mode(not self.option('no-dev')) installer.dry_run(self.option('dry-run')) return installer.run()
poetry/console/commands/update.py 0 → 100644 +33 −0 Changes for poetry/console/commands/update.py: 33 added lines, 0 removed lines. Original line number Diff line number Diff line from poetry.installation import Installer from poetry.repositories.pypi_repository import PyPiRepository from .command import Command class UpdateCommand(Command): """ Update dependencies as according to the <comment>poetry.toml</> file. update { packages?* : The packages to update. } { --f|features=* : Features to install. } { --no-dev : Do not install dev dependencies. } { --dry-run : Outputs the operations but will not execute anything (implicitly enables --verbose). } """ def handle(self): installer = Installer( self.output, self.poetry.package, self.poetry.locker, PyPiRepository() ) installer.dev_mode(not self.option('no-dev')) installer.dry_run(self.option('dry-run')) # Force update installer.update(True) return installer.run()
poetry/installation/installer.py +33 −9 Changes for poetry/installation/installer.py: 33 added lines, 9 removed lines. Original line number Diff line number Diff line Loading @@ -98,18 +98,18 @@ class Installer: def _do_install(self, local_repo): locked_repository = Repository() # initialize locked repo if we are installing from lock if not self._update: if not self._update or self._locker.is_locked(): locked_repository = self._locker.locked_repository(self._dev_mode) if self._update: self._io.writeln('<info>Updating dependencies</>') solver = Solver(locked_repository, self._io) request = self._package.requires if self.is_dev_mode(): request += self._package.dev_requires if self._update: self._io.writeln('<info>Updating dependencies</>') ops = solver.solve(request, self._repository) else: self._io.writeln('<info>Installing dependencies from lock file</>') Loading @@ -130,7 +130,7 @@ class Installer: # if they are present in the local repo # TODO if ops and self._execute_operations: if ops and (self._execute_operations or self._dry_run): installs = [] updates = [] uninstalls = [] Loading Loading @@ -166,7 +166,6 @@ class Installer: elif op.job_type == 'update': local_repo.add_package(op.target_package) if self._execute_operations: self._execute(op) def _execute(self, operation: Operation) -> None: Loading @@ -178,15 +177,40 @@ class Installer: getattr(self, f'_execute_{method}')(operation) def _execute_install(self, operation: Install) -> None: self._io.writeln( f' - Installing <info>{operation.package.name}</> ' f'(<comment>{operation.package.full_pretty_version}</>)' ) if not self._execute_operations: return self._installer.install(operation.package) def _execute_update(self, operation: Update) -> None: self._installer.update( operation.initial_package, operation.target_package source = operation.target_package target = operation.target_package self._io.writeln( f' - Updating <info>{target.name}</> ' f'(<comment>{source.pretty_version}</>' f' -> <comment>{target.pretty_version}</>)' ) if not self._execute_operations: return self._installer.update(source, target) def _execute_uninstall(self, operation: Uninstall) -> None: self._io.writeln( f' - Removing <info>{operation.package.name}</> ' f'(<comment>{operation.package.full_pretty_version}</>)' ) if not self._execute_operations: return self._installer.remove(operation.package) def _get_operations_from_lock(self, Loading