Skip to content

Commit

Permalink
not every InstallerCommand is an EnvCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
dimbleby committed Aug 31, 2022
1 parent 0fc1e3b commit cead246
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/poetry/console/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,9 @@ def configure_env(
self, event: ConsoleCommandEvent, event_name: str, _: Any
) -> None:
from poetry.console.commands.env_command import EnvCommand
from poetry.console.commands.self.self_command import SelfCommand

command = event.command
if not isinstance(command, EnvCommand) or isinstance(command, SelfCommand):
if not isinstance(command, EnvCommand):
return

if command._env is not None:
Expand Down
3 changes: 2 additions & 1 deletion src/poetry/console/commands/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@

from poetry.console.commands.init import InitCommand
from poetry.console.commands.installer_command import InstallerCommand
from poetry.console.commands.env_command import EnvCommand


class AddCommand(InstallerCommand, InitCommand):
class AddCommand(InstallerCommand, EnvCommand, InitCommand):
name = "add"
description = "Adds a new dependency to <comment>pyproject.toml</>."

Expand Down
3 changes: 2 additions & 1 deletion src/poetry/console/commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

from cleo.helpers import option

from poetry.console.commands.env_command import EnvCommand
from poetry.console.commands.installer_command import InstallerCommand


class InstallCommand(InstallerCommand):
class InstallCommand(InstallerCommand, EnvCommand):
name = "install"
description = "Installs the project dependencies."

Expand Down
3 changes: 1 addition & 2 deletions src/poetry/console/commands/installer_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

from typing import TYPE_CHECKING

from poetry.console.commands.env_command import EnvCommand
from poetry.console.commands.group_command import GroupCommand


if TYPE_CHECKING:
from poetry.installation.installer import Installer


class InstallerCommand(GroupCommand, EnvCommand):
class InstallerCommand(GroupCommand):
def __init__(self) -> None:
# Set in poetry.console.application.Application.configure_installer
self._installer: Installer | None = None
Expand Down
3 changes: 2 additions & 1 deletion src/poetry/console/commands/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

from cleo.helpers import option

from poetry.console.commands.env_command import EnvCommand
from poetry.console.commands.installer_command import InstallerCommand


class LockCommand(InstallerCommand):
class LockCommand(InstallerCommand, EnvCommand):
name = "lock"
description = "Locks the project dependencies."

Expand Down
3 changes: 2 additions & 1 deletion src/poetry/console/commands/remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
from poetry.core.packages.dependency_group import MAIN_GROUP
from tomlkit.toml_document import TOMLDocument

from poetry.console.commands.env_command import EnvCommand
from poetry.console.commands.installer_command import InstallerCommand


class RemoveCommand(InstallerCommand):
class RemoveCommand(InstallerCommand, EnvCommand):
name = "remove"
description = "Removes a package from the project dependencies."

Expand Down
3 changes: 2 additions & 1 deletion src/poetry/console/commands/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
from cleo.helpers import argument
from cleo.helpers import option

from poetry.console.commands.env_command import EnvCommand
from poetry.console.commands.installer_command import InstallerCommand


class UpdateCommand(InstallerCommand):
class UpdateCommand(InstallerCommand, EnvCommand):
name = "update"
description = (
"Update the dependencies as according to the <comment>pyproject.toml</> file."
Expand Down

0 comments on commit cead246

Please sign in to comment.