Example #1
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
Example #2
0
    def handle(self):
        from clikit.io import NullIO
        from poetry.installation.installer import Installer
        from poetry.masonry.builders import EditableBuilder
        from poetry.masonry.utils.module import ModuleOrPackageNotFound

        installer = Installer(self.io, self.env, self.poetry.package,
                              self.poetry.locker, self.poetry.pool)

        extras = []
        for extra in self.option("extras"):
            if " " in extra:
                extras += [e.strip() for e in extra.split(" ")]
            else:
                extras.append(extra)

        installer.extras(extras)
        installer.dev_mode(not self.option("no-dev"))
        installer.dry_run(self.option("dry-run"))
        installer.verbose(self.option("verbose"))

        return_code = installer.run()

        if return_code != 0:
            return return_code

        if self.option("no-root"):
            return 0

        try:
            builder = EditableBuilder(self.poetry, self._env, NullIO())
        except ModuleOrPackageNotFound:
            # This is likely due to the fact that the project is an application
            # not following the structure expected by Poetry
            # If this is a true error it will be picked up later by build anyway.
            return 0

        self.line("  - Installing <c1>{}</c1> (<b>{}</b>)".format(
            self.poetry.package.pretty_name,
            self.poetry.package.pretty_version))

        if self.option("dry-run"):
            return 0

        builder.build()

        return 0
Example #3
0
    def handle(self):
        from poetry.installation.installer import Installer

        packages = self.argument("packages")

        installer = Installer(self.io, self.env, self.poetry.package,
                              self.poetry.locker, self.poetry.pool)

        if packages:
            installer.whitelist({name: "*" for name in packages})

        installer.dev_mode(not self.option("no-dev"))
        installer.dry_run(self.option("dry-run"))
        installer.execute_operations(not self.option("lock"))

        # Force update
        installer.update(True)

        return installer.run()