Skip to content

Commit

Permalink
Update build script for PIO 4.4 (MarlinFirmware#19034)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhapsodyv authored and vgadreau committed Dec 9, 2020
1 parent 50651b4 commit 9cf3ed0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:

- name: Install PlatformIO
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
- name: Check out the PR
Expand Down
24 changes: 18 additions & 6 deletions buildroot/share/PlatformIO/scripts/common-dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,24 @@
import configparser
except ImportError:
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")

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):
feat = FEATURE_CONFIG[feature]
atoms = re.sub(',\\s*', '\n', flines).strip().split('\n')
Expand Down Expand Up @@ -56,15 +68,15 @@ def get_all_known_libs():
if not 'lib_deps' in feat:
continue
for dep in feat['lib_deps']:
name, _, _ = PackageManager.parse_pkg_uri(dep)
name = parse_pkg_uri(dep)
known_libs.append(name)
return known_libs

def get_all_env_libs():
env_libs = []
lib_deps = env.GetProjectOption('lib_deps')
for dep in lib_deps:
name, _, _ = PackageManager.parse_pkg_uri(dep)
name = parse_pkg_uri(dep)
env_libs.append(name)
return env_libs

Expand Down Expand Up @@ -96,20 +108,20 @@ def apply_features_config():
# feat to add
deps_to_add = {}
for dep in feat['lib_deps']:
name, _, _ = PackageManager.parse_pkg_uri(dep)
name = parse_pkg_uri(dep)
deps_to_add[name] = dep

# Does the env already have the dependency?
deps = env.GetProjectOption('lib_deps')
for dep in deps:
name, _, _ = PackageManager.parse_pkg_uri(dep)
name = parse_pkg_uri(dep)
if name in deps_to_add:
del deps_to_add[name]

# Are there any libraries that should be ignored?
lib_ignore = env.GetProjectOption('lib_ignore')
for dep in deps:
name, _, _ = PackageManager.parse_pkg_uri(dep)
name = parse_pkg_uri(dep)
if name in deps_to_add:
del deps_to_add[name]

Expand Down

0 comments on commit 9cf3ed0

Please sign in to comment.