forked from platformio/platformio-core
Minor enhancements
This commit is contained in:
1 parent
99e0d1071a
commit
95604ff66a
10 files changed
+32
-30
No files matched your search
@@ -36,11 +36,13 @@ class PlatformPackagesMixin(object):
|
||||
pkg = self.get_package(name)
|
||||
return str(pkg.metadata.version) if pkg else None
|
||||
|
||||
def get_installed_packages(self, with_optional=False):
|
||||
def get_installed_packages(self, with_optional=True, with_optional_versions=False):
|
||||
result = []
|
||||
for name, options in self.packages.items():
|
||||
for name, options in dict(sorted(self.packages.items())).items():
|
||||
if not with_optional and options.get("optional"):
|
||||
continue
|
||||
versions = [options.get("version")]
|
||||
if with_optional:
|
||||
if with_optional_versions:
|
||||
versions.extend(options.get("optionalVersions", []))
|
||||
for version in versions:
|
||||
if not version:
|
||||
|
||||
@@ -36,7 +36,7 @@ class PlatformFactory(object):
|
||||
raise UnknownPlatform(name)
|
||||
|
||||
@classmethod
|
||||
def new(cls, pkg_or_spec, autoinstall=False):
|
||||
def new(cls, pkg_or_spec, autoinstall=False) -> PlatformBase:
|
||||
# pylint: disable=import-outside-toplevel
|
||||
from platformio.package.manager.platform import PlatformPackageManager
|
||||
|
||||
|
||||
Reference in new issue
Block a user