forked from platformio/platformio-core
Check system compatibility for package
This commit is contained in:
5
Makefile
5
Makefile
@ -9,7 +9,10 @@ isort:
|
|||||||
yapf:
|
yapf:
|
||||||
yapf --recursive --in-place platformio/
|
yapf --recursive --in-place platformio/
|
||||||
|
|
||||||
before-commit: isort yapf lint
|
test:
|
||||||
|
py.test -v -s tests --ignore tests/test_examples.py --ignore tests/test_pkgmanifest.py
|
||||||
|
|
||||||
|
before-commit: isort yapf lint test
|
||||||
|
|
||||||
clean-docs:
|
clean-docs:
|
||||||
rm -rf docs/_build
|
rm -rf docs/_build
|
||||||
|
@ -78,9 +78,15 @@ class PkgRepoMixin(object):
|
|||||||
PIO_VERSION = semantic_version.Version(util.pepver_to_semver(__version__))
|
PIO_VERSION = semantic_version.Version(util.pepver_to_semver(__version__))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def max_satisfying_repo_version(versions, requirements=None):
|
def is_system_compatible(valid_systems):
|
||||||
|
if valid_systems in (None, "all", "*"):
|
||||||
|
return True
|
||||||
|
if not isinstance(valid_systems, list):
|
||||||
|
valid_systems = list([valid_systems])
|
||||||
|
return util.get_systype() in valid_systems
|
||||||
|
|
||||||
|
def max_satisfying_repo_version(self, versions, requirements=None):
|
||||||
item = None
|
item = None
|
||||||
systype = util.get_systype()
|
|
||||||
reqspec = None
|
reqspec = None
|
||||||
if requirements:
|
if requirements:
|
||||||
try:
|
try:
|
||||||
@ -89,8 +95,7 @@ class PkgRepoMixin(object):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
for v in versions:
|
for v in versions:
|
||||||
if "system" in v and v['system'] not in ("all", "*") and \
|
if not self.is_system_compatible(v.get("system")):
|
||||||
systype not in v['system']:
|
|
||||||
continue
|
continue
|
||||||
if "platformio" in v.get("engines", {}):
|
if "platformio" in v.get("engines", {}):
|
||||||
if PkgRepoMixin.PIO_VERSION not in semantic_version.Spec(
|
if PkgRepoMixin.PIO_VERSION not in semantic_version.Spec(
|
||||||
@ -305,6 +310,8 @@ class PkgInstallerMixin(object):
|
|||||||
continue
|
continue
|
||||||
elif not pkg_id and manifest['name'] != name:
|
elif not pkg_id and manifest['name'] != name:
|
||||||
continue
|
continue
|
||||||
|
elif not PkgRepoMixin.is_system_compatible(manifest.get("system")):
|
||||||
|
continue
|
||||||
|
|
||||||
# strict version or VCS HASH
|
# strict version or VCS HASH
|
||||||
if requirements and requirements == manifest['version']:
|
if requirements and requirements == manifest['version']:
|
||||||
|
Reference in New Issue
Block a user