当前位置: 首页>>代码示例>>Python>>正文


Python PackageManager.get_installed方法代码示例

本文整理汇总了Python中platformio.pkgmanager.PackageManager.get_installed方法的典型用法代码示例。如果您正苦于以下问题:Python PackageManager.get_installed方法的具体用法?Python PackageManager.get_installed怎么用?Python PackageManager.get_installed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在platformio.pkgmanager.PackageManager的用法示例。


在下文中一共展示了PackageManager.get_installed方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: cli

# 需要导入模块: from platformio.pkgmanager import PackageManager [as 别名]
# 或者: from platformio.pkgmanager.PackageManager import get_installed [as 别名]
def cli():

    for name, pkgs in PackageManager.get_installed().items():
        echo("{name:<20} with packages: {pkgs}".format(
            name=style(name, fg="cyan"),
            pkgs=", ".join(pkgs.keys())
        ))
开发者ID:bettabacon,项目名称:platformio,代码行数:9,代码来源:list.py

示例2: cli

# 需要导入模块: from platformio.pkgmanager import PackageManager [as 别名]
# 或者: from platformio.pkgmanager.PackageManager import get_installed [as 别名]
def cli():

    for platform in PackageManager.get_installed().keys():
        echo("\nPlatform %s" % style(platform, fg="cyan"))
        echo("--------")
        p = PlatformFactory().newPlatform(platform)
        p.update()
开发者ID:bettabacon,项目名称:platformio,代码行数:9,代码来源:update.py

示例3: run

# 需要导入模块: from platformio.pkgmanager import PackageManager [as 别名]
# 或者: from platformio.pkgmanager.PackageManager import get_installed [as 别名]
    def run(self, variables, targets, verbose):
        assert isinstance(variables, dict)
        assert isinstance(targets, list)

        self.configure_default_packages(variables, targets)
        self._install_default_packages()

        self._verbose_level = int(verbose)

        if "clean" in targets:
            targets.remove("clean")
            targets.append("-c")

        if "build_script" not in variables:
            variables['build_script'] = self.get_build_script()
        if not isfile(variables['build_script']):
            raise exception.BuildScriptNotFound(variables['build_script'])

        # append aliases of the installed packages
        installed_packages = PackageManager.get_installed()
        for name, options in self.get_packages().items():
            if "alias" not in options or name not in installed_packages:
                continue
            variables['piopackage_%s' % options['alias']] = name

        self._found_error = False
        result = self._run_scons(variables, targets)
        assert "returncode" in result
        # if self._found_error:
        #     result['returncode'] = 1

        if self._last_echo_line == ".":
            click.echo("")

        return result
开发者ID:DamnedScholar,项目名称:platformio,代码行数:37,代码来源:base.py

示例4: platforms_show

# 需要导入模块: from platformio.pkgmanager import PackageManager [as 别名]
# 或者: from platformio.pkgmanager.PackageManager import get_installed [as 别名]
def platforms_show(ctx, platform):

    installed_platforms = PlatformFactory.get_platforms(
        installed=True).keys()

    if platform not in installed_platforms:
        if (not app.get_setting("enable_prompts") or
                click.confirm("The platform '%s' has not been installed yet. "
                              "Would you like to install it now?" % platform)):
            ctx.invoke(platforms_install, platforms=[platform])
        else:
            raise PlatformNotInstalledYet(platform)

    p = PlatformFactory.newPlatform(platform)
    click.echo("{name:<20} - {description} [ {url} ]".format(
        name=click.style(p.get_type(), fg="cyan"),
        description=p.get_description(), url=p.get_vendor_url()))

    installed_packages = PackageManager.get_installed()
    for name in p.get_installed_packages():
        data = installed_packages[name]
        pkgalias = p.get_pkg_alias(name)
        click.echo("----------")
        click.echo("Package: %s" % click.style(name, fg="yellow"))
        if pkgalias:
            click.echo("Alias: %s" % pkgalias)
        click.echo("Version: %d" % int(data['version']))
        click.echo("Installed: %s" % datetime.fromtimestamp(
            data['time']).strftime("%Y-%m-%d %H:%M:%S"))
开发者ID:akaash-nigam,项目名称:platformio,代码行数:31,代码来源:platforms.py

示例5: run

# 需要导入模块: from platformio.pkgmanager import PackageManager [as 别名]
# 或者: from platformio.pkgmanager.PackageManager import get_installed [as 别名]
    def run(self, variables, targets, verbose):
        assert isinstance(variables, list)
        assert isinstance(targets, list)

        self._verbose_level = int(verbose)

        installed_platforms = PlatformFactory.get_platforms(
            installed=True).keys()
        installed_packages = PackageManager.get_installed()

        if self.get_type() not in installed_platforms:
            raise exception.PlatformNotInstalledYet(self.get_type())

        if "clean" in targets:
            targets.remove("clean")
            targets.append("-c")

        if not any([v.startswith("BUILD_SCRIPT=") for v in variables]):
            variables.append("BUILD_SCRIPT=%s" % self.get_build_script())

        for v in variables:
            if not v.startswith("BUILD_SCRIPT="):
                continue
            _, path = v.split("=", 2)
            if not isfile(path):
                raise exception.BuildScriptNotFound(path)

        # append aliases of the installed packages
        for name, options in self.get_packages().items():
            if "alias" not in options or name not in installed_packages:
                continue
            variables.append(
                "PIOPACKAGE_%s=%s" % (options['alias'].upper(), name))

        self._found_error = False
        try:
            # test that SCons is installed correctly
            assert util.test_scons()

            result = util.exec_command(
                [
                    "scons",
                    "-Q",
                    "-f", join(util.get_source_dir(), "builder", "main.py")
                ] + variables + targets,
                stdout=util.AsyncPipe(self.on_run_out),
                stderr=util.AsyncPipe(self.on_run_err)
            )
        except (OSError, AssertionError):
            raise exception.SConsNotInstalledError()

        assert "returncode" in result
        # if self._found_error:
        #     result['returncode'] = 1

        if self._last_echo_line == ".":
            click.echo("")

        return result
开发者ID:Staudenmaier,项目名称:platformio,代码行数:61,代码来源:base.py

示例6: uninstall

# 需要导入模块: from platformio.pkgmanager import PackageManager [as 别名]
# 或者: from platformio.pkgmanager.PackageManager import get_installed [as 别名]
    def uninstall(self):
        platform = self.get_name()
        pm = PackageManager(platform)

        for package, data in pm.get_installed(platform).items():
            pm.uninstall(package, data['path'])

        pm.unregister_platform(platform)
        rmtree(pm.get_platform_dir())
        return True
开发者ID:bettabacon,项目名称:platformio,代码行数:12,代码来源:base.py

示例7: cli

# 需要导入模块: from platformio.pkgmanager import PackageManager [as 别名]
# 或者: from platformio.pkgmanager.PackageManager import get_installed [as 别名]
def cli(platforms):

    for platform in platforms:

        if platform not in PackageManager.get_installed():
            raise PlatformNotInstalledYet(platform)

        p = PlatformFactory().newPlatform(platform)
        if p.uninstall():
            secho("The platform '%s' has been successfully "
                  "uninstalled!" % platform, fg="green")
开发者ID:bettabacon,项目名称:platformio,代码行数:13,代码来源:uninstall.py

示例8: run

# 需要导入模块: from platformio.pkgmanager import PackageManager [as 别名]
# 或者: from platformio.pkgmanager.PackageManager import get_installed [as 别名]
    def run(self, variables, targets, verbose):
        assert isinstance(variables, list)
        assert isinstance(targets, list)

        envoptions = {}
        for v in variables:
            _name, _value = v.split("=", 1)
            envoptions[_name.lower()] = _value

        self.configure_default_packages(envoptions, targets)
        self._install_default_packages()

        self._verbose_level = int(verbose)

        if "clean" in targets:
            targets.remove("clean")
            targets.append("-c")

        if "build_script" not in envoptions:
            variables.append("BUILD_SCRIPT=%s" % self.get_build_script())

        for v in variables:
            if not v.startswith("BUILD_SCRIPT="):
                continue
            _, path = v.split("=", 1)
            if not isfile(path):
                raise exception.BuildScriptNotFound(path)

        # append aliases of the installed packages
        installed_packages = PackageManager.get_installed()
        for name, options in self.get_packages().items():
            if "alias" not in options or name not in installed_packages:
                continue
            variables.append(
                "PIOPACKAGE_%s=%s" % (options['alias'].upper(), name))

        self._found_error = False
        result = self._run_scons(variables, targets)
        assert "returncode" in result
        # if self._found_error:
        #     result['returncode'] = 1

        if self._last_echo_line == ".":
            click.echo("")

        return result
开发者ID:TopperBB,项目名称:platformio,代码行数:48,代码来源:base.py

示例9: run

# 需要导入模块: from platformio.pkgmanager import PackageManager [as 别名]
# 或者: from platformio.pkgmanager.PackageManager import get_installed [as 别名]
    def run(self, variables, targets, verbose):
        assert isinstance(variables, list)
        assert isinstance(targets, list)

        envoptions = {}
        for v in variables:
            _name, _value = v.split("=", 1)
            envoptions[_name.lower()] = _value

        self.configure_default_packages(envoptions, targets)
        self._install_default_packages()

        self._verbose_level = int(verbose)

        if "clean" in targets:
            targets.remove("clean")
            targets.append("-c")

        if "build_script" not in envoptions:
            variables.append("BUILD_SCRIPT=%s" % self.get_build_script())

        for v in variables:
            if not v.startswith("BUILD_SCRIPT="):
                continue
            _, path = v.split("=", 1)
            if not isfile(path):
                raise exception.BuildScriptNotFound(path)

        # append aliases of the installed packages
        installed_packages = PackageManager.get_installed()
        for name, options in self.get_packages().items():
            if "alias" not in options or name not in installed_packages:
                continue
            variables.append(
                "PIOPACKAGE_%s=%s" % (options['alias'].upper(), name))

        self._found_error = False
        try:
            # test that SCons is installed correctly
            assert util.test_scons()

            result = util.exec_command(
                [
                    "scons",
                    "-Q",
                    "-j %d" % self.get_job_nums(),
                    "--warn=no-no-parallel-support",
                    "-f", join(util.get_source_dir(), "builder", "main.py")
                ] + variables + targets,
                stdout=util.AsyncPipe(self.on_run_out),
                stderr=util.AsyncPipe(self.on_run_err)
            )
        except (OSError, AssertionError):
            raise exception.SConsNotInstalledError()

        assert "returncode" in result
        # if self._found_error:
        #     result['returncode'] = 1

        if self._last_echo_line == ".":
            click.echo("")

        return result
开发者ID:dh1tw,项目名称:platformio,代码行数:65,代码来源:base.py

示例10: run

# 需要导入模块: from platformio.pkgmanager import PackageManager [as 别名]
# 或者: from platformio.pkgmanager.PackageManager import get_installed [as 别名]
    def run(self, variables, targets, verbose):
        assert isinstance(variables, list)
        assert isinstance(targets, list)

        envoptions = {}
        for v in variables:
            _name, _value = v.split("=", 1)
            envoptions[_name.lower()] = _value

        self.configure_default_packages(envoptions, targets)
        self._install_default_packages()

        self._verbose_level = int(verbose)

        if "clean" in targets:
            targets.remove("clean")
            targets.append("-c")

        if "build_script" not in envoptions:
            variables.append("BUILD_SCRIPT=%s" % self.get_build_script())

        for v in variables:
            if not v.startswith("BUILD_SCRIPT="):
                continue
            _, path = v.split("=", 1)
            if not isfile(path):
                raise exception.BuildScriptNotFound(path)

        # append aliases of the installed packages
        installed_packages = PackageManager.get_installed()
        for name, options in self.get_packages().items():
            if "alias" not in options or name not in installed_packages:
                continue
            variables.append("PIOPACKAGE_%s=%s" % (options["alias"].upper(), name))

        self._found_error = False
        args = []
        try:
            args = (
                [
                    os.path.relpath(PathsManager.EXECUTABLE_FILE),  # [JORGE_GARCIA] modified for scons compatibility
                    "-Q",
                    "-j %d" % self.get_job_nums(),
                    "--warn=no-no-parallel-support",
                    "-f",
                    join(util.get_source_dir(), "builder", "main.py"),
                ]
                + variables
                + targets
                + [os.getcwd()]
            )
            if PathsManager.EXECUTABLE_FILE.endswith(".py"):
                args = ["python"] + args
            # test that SCons is installed correctly
            # assert util.test_scons()
            log.debug("Executing: {}".format("\n".join(args)))
            result = util.exec_command(
                args, stdout=util.AsyncPipe(self.on_run_out), stderr=util.AsyncPipe(self.on_run_err)
            )

        except (OSError, AssertionError) as e:
            log.exception("error running scons with \n{}".format(args))
            raise exception.SConsNotInstalledError()

        assert "returncode" in result
        # if self._found_error:
        #     result['returncode'] = 1

        if self._last_echo_line == ".":
            click.echo("")

        return result
开发者ID:bq,项目名称:bitbloq-offline,代码行数:74,代码来源:base.py

示例11: update

# 需要导入模块: from platformio.pkgmanager import PackageManager [as 别名]
# 或者: from platformio.pkgmanager.PackageManager import get_installed [as 别名]
 def update(self):
     platform = self.get_name()
     pm = PackageManager(platform)
     for package in pm.get_installed(platform).keys():
         pm.update(package)
开发者ID:bettabacon,项目名称:platformio,代码行数:7,代码来源:base.py


注:本文中的platformio.pkgmanager.PackageManager.get_installed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。