Update build script for PIO 4.4 (#19034)
This commit is contained in:
parent
f9f514a46c
commit
73d1a98ce6
2
.github/workflows/test-builds.yml
vendored
2
.github/workflows/test-builds.yml
vendored
@ -106,7 +106,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Install PlatformIO
|
- name: Install PlatformIO
|
||||||
run: |
|
run: |
|
||||||
pip install -U https://github.com/platformio/platformio-core/archive/develop.zip
|
pip install -U https://github.com/platformio/platformio-core/archive/master.zip
|
||||||
platformio update
|
platformio update
|
||||||
|
|
||||||
- name: Check out the PR
|
- name: Check out the PR
|
||||||
|
@ -9,12 +9,24 @@ try:
|
|||||||
import configparser
|
import configparser
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import ConfigParser as configparser
|
import ConfigParser as configparser
|
||||||
from platformio.managers.package import PackageManager
|
try:
|
||||||
|
# PIO < 4.4
|
||||||
|
from platformio.managers.package import PackageManager
|
||||||
|
except ImportError:
|
||||||
|
# PIO >= 4.4
|
||||||
|
from platformio.package.meta import PackageSpec as PackageManager
|
||||||
|
|
||||||
Import("env")
|
Import("env")
|
||||||
|
|
||||||
FEATURE_CONFIG = {}
|
FEATURE_CONFIG = {}
|
||||||
|
|
||||||
|
def parse_pkg_uri(spec):
|
||||||
|
if PackageManager.__name__ == 'PackageSpec':
|
||||||
|
return PackageManager(spec).name
|
||||||
|
else:
|
||||||
|
name, _, _ = PackageManager.parse_pkg_uri(spec)
|
||||||
|
return name
|
||||||
|
|
||||||
def add_to_feat_cnf(feature, flines):
|
def add_to_feat_cnf(feature, flines):
|
||||||
feat = FEATURE_CONFIG[feature]
|
feat = FEATURE_CONFIG[feature]
|
||||||
atoms = re.sub(',\\s*', '\n', flines).strip().split('\n')
|
atoms = re.sub(',\\s*', '\n', flines).strip().split('\n')
|
||||||
@ -56,7 +68,7 @@ def get_all_known_libs():
|
|||||||
if not 'lib_deps' in feat:
|
if not 'lib_deps' in feat:
|
||||||
continue
|
continue
|
||||||
for dep in feat['lib_deps']:
|
for dep in feat['lib_deps']:
|
||||||
name, _, _ = PackageManager.parse_pkg_uri(dep)
|
name = parse_pkg_uri(dep)
|
||||||
known_libs.append(name)
|
known_libs.append(name)
|
||||||
return known_libs
|
return known_libs
|
||||||
|
|
||||||
@ -64,7 +76,7 @@ def get_all_env_libs():
|
|||||||
env_libs = []
|
env_libs = []
|
||||||
lib_deps = env.GetProjectOption('lib_deps')
|
lib_deps = env.GetProjectOption('lib_deps')
|
||||||
for dep in lib_deps:
|
for dep in lib_deps:
|
||||||
name, _, _ = PackageManager.parse_pkg_uri(dep)
|
name = parse_pkg_uri(dep)
|
||||||
env_libs.append(name)
|
env_libs.append(name)
|
||||||
return env_libs
|
return env_libs
|
||||||
|
|
||||||
@ -96,20 +108,20 @@ def apply_features_config():
|
|||||||
# feat to add
|
# feat to add
|
||||||
deps_to_add = {}
|
deps_to_add = {}
|
||||||
for dep in feat['lib_deps']:
|
for dep in feat['lib_deps']:
|
||||||
name, _, _ = PackageManager.parse_pkg_uri(dep)
|
name = parse_pkg_uri(dep)
|
||||||
deps_to_add[name] = dep
|
deps_to_add[name] = dep
|
||||||
|
|
||||||
# Does the env already have the dependency?
|
# Does the env already have the dependency?
|
||||||
deps = env.GetProjectOption('lib_deps')
|
deps = env.GetProjectOption('lib_deps')
|
||||||
for dep in deps:
|
for dep in deps:
|
||||||
name, _, _ = PackageManager.parse_pkg_uri(dep)
|
name = parse_pkg_uri(dep)
|
||||||
if name in deps_to_add:
|
if name in deps_to_add:
|
||||||
del deps_to_add[name]
|
del deps_to_add[name]
|
||||||
|
|
||||||
# Are there any libraries that should be ignored?
|
# Are there any libraries that should be ignored?
|
||||||
lib_ignore = env.GetProjectOption('lib_ignore')
|
lib_ignore = env.GetProjectOption('lib_ignore')
|
||||||
for dep in deps:
|
for dep in deps:
|
||||||
name, _, _ = PackageManager.parse_pkg_uri(dep)
|
name = parse_pkg_uri(dep)
|
||||||
if name in deps_to_add:
|
if name in deps_to_add:
|
||||||
del deps_to_add[name]
|
del deps_to_add[name]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user