Пример #1
0
    def set_installer(self, event, event_name,
                      _):  # type: (PreHandleEvent, str, Any) -> None
        command = event.command.config.handler  # type: InstallerCommand
        if not isinstance(command, InstallerCommand):
            return

        # If the command already has an installer
        # we skip this step
        if command.installer is not None:
            return

        from poetry.installation.installer import Installer

        poetry = command.poetry
        installer = Installer(
            event.io,
            command.env,
            poetry.package,
            poetry.locker,
            poetry.pool,
            poetry.config,
        )
        installer.use_executor(
            poetry.config.get("experimental.new-installer", False))
        command.set_installer(installer)
Пример #2
0
    def set_installer(self, event: ConsoleCommandEvent, event_name: str,
                      _: Any) -> None:
        from .commands.installer_command import InstallerCommand

        command: InstallerCommand = cast(InstallerCommand, event.command)
        if not isinstance(command, InstallerCommand):
            return

        # If the command already has an installer
        # we skip this step
        if command.installer is not None:
            return

        from poetry.installation.installer import Installer

        poetry = command.poetry
        installer = Installer(
            event.io,
            command.env,
            poetry.package,
            poetry.locker,
            poetry.pool,
            poetry.config,
        )
        installer.use_executor(
            poetry.config.get("experimental.new-installer", False))
        command.set_installer(installer)
Пример #3
0
    def _configure_installer(self, command: InstallerCommand, io: IO) -> None:
        from poetry.installation.installer import Installer

        poetry = command.poetry
        installer = Installer(
            io,
            command.env,
            poetry.package,
            poetry.locker,
            poetry.pool,
            poetry.config,
        )
        installer.use_executor(poetry.config.get("experimental.new-installer", False))
        command.set_installer(installer)
Пример #4
0
def _make_installer(poetry, env, io):
    "Make a fresh installer."
    installer = Installer(
        NullIO() if not io.is_debug() else io,
        env,
        poetry.package,
        poetry.locker,
        poetry.pool,
        poetry.config,
    )
    installer.dev_mode(False)
    installer.remove_untracked()
    installer.use_executor(
        poetry.config.get("experimental.new-installer", False))
    return installer
Пример #5
0
def tester(app, poetry, config, executor, env):
    tester = CommandTester(app.find("add"))

    executor._io = tester.io

    installer = Installer(
        tester.io,
        env,
        poetry.package,
        poetry.locker,
        poetry.pool,
        config,
        executor=executor,
    )
    installer.use_executor(True)
    tester._command.set_installer(installer)
    tester._command.set_env(env)

    return tester