Exemplo n.º 1
0
Arquivo: espidf.py Projeto: OS-Q/P511
def create_version_file():
    version_file = os.path.join(FRAMEWORK_DIR, "version.txt")
    if not os.path.isfile(version_file):
        with open(version_file, "w") as fp:
            fp.write(
                get_original_version(
                    platform.get_package_version("framework-espidf")))
Exemplo n.º 2
0
def _get_installed_platform_data(platform,
                                 with_boards=True,
                                 expose_packages=True):
    p = PlatformFactory.new(platform)
    data = dict(
        name=p.name,
        title=p.title,
        description=p.description,
        version=p.version,
        homepage=p.homepage,
        url=p.homepage,
        repository=p.repository_url,
        license=p.license,
        forDesktop=not p.is_embedded(),
        frameworks=sorted(list(p.frameworks) if p.frameworks else []),
        packages=list(p.packages) if p.packages else [],
    )

    # if dump to API
    # del data['version']
    # return data

    # overwrite VCS version and add extra fields
    manifest = PlatformPackageManager().legacy_load_manifest(
        os.path.dirname(p.manifest_path))
    assert manifest
    for key in manifest:
        if key == "version" or key.startswith("__"):
            data[key] = manifest[key]

    if with_boards:
        data["boards"] = [c.get_brief_data() for c in p.get_boards().values()]

    if not data["packages"] or not expose_packages:
        return data

    data["packages"] = []
    installed_pkgs = {
        pkg.metadata.name: p.pm.load_manifest(pkg)
        for pkg in p.get_installed_packages()
    }
    for name, options in p.packages.items():
        item = dict(
            name=name,
            type=p.get_package_type(name),
            requirements=options.get("version"),
            optional=options.get("optional") is True,
        )
        if name in installed_pkgs:
            for key, value in installed_pkgs[name].items():
                if key not in ("url", "version", "description"):
                    continue
                item[key] = value
                if key == "version":
                    item["originalVersion"] = get_original_version(value)
        data["packages"].append(item)

    return data
Exemplo n.º 3
0
 def _get_packages_data():
     data = []
     for item in platform.dump_used_packages():
         original_version = get_original_version(item["version"])
         info = "%s %s" % (item["name"], item["version"])
         extra = []
         if original_version:
             extra.append(original_version)
         if "src_url" in item and int(ARGUMENTS.get("PIOVERBOSE", 0)):
             extra.append(item["src_url"])
         if extra:
             info += " (%s)" % ", ".join(extra)
         data.append(info)
     if not data:
         return None
     return ["PACKAGES:"] + ["\n - %s" % d for d in sorted(data)]