Browse Source

Update build script for PIO 4.4 (#19034)

Victor Oliveira 4 years ago
parent
commit
bb64aa7841
No account linked to committer's email address

+ 1
- 1
.github/workflows/test-builds.yml View File

@@ -106,7 +106,7 @@ jobs:
106 106
 
107 107
     - name: Install PlatformIO
108 108
       run: |
109
-        pip install -U https://github.com/platformio/platformio-core/archive/develop.zip
109
+        pip install -U https://github.com/platformio/platformio-core/archive/master.zip
110 110
         platformio update
111 111
 
112 112
     - name: Check out the PR

+ 18
- 6
buildroot/share/PlatformIO/scripts/common-dependencies.py View File

@@ -9,12 +9,24 @@ try:
9 9
 	import configparser
10 10
 except ImportError:
11 11
 	import ConfigParser as configparser
12
-from platformio.managers.package import PackageManager
12
+try:
13
+	# PIO < 4.4
14
+	from platformio.managers.package import PackageManager
15
+except ImportError:
16
+	# PIO >= 4.4
17
+	from platformio.package.meta import PackageSpec as PackageManager
13 18
 
14 19
 Import("env")
15 20
 
16 21
 FEATURE_CONFIG = {}
17 22
 
23
+def parse_pkg_uri(spec):
24
+	if PackageManager.__name__ == 'PackageSpec':
25
+		return PackageManager(spec).name
26
+	else:
27
+		name, _, _ = PackageManager.parse_pkg_uri(spec)
28
+		return name
29
+
18 30
 def add_to_feat_cnf(feature, flines):
19 31
 	feat = FEATURE_CONFIG[feature]
20 32
 	atoms = re.sub(',\\s*', '\n', flines).strip().split('\n')
@@ -56,7 +68,7 @@ def get_all_known_libs():
56 68
 		if not 'lib_deps' in feat:
57 69
 			continue
58 70
 		for dep in feat['lib_deps']:
59
-			name, _, _ = PackageManager.parse_pkg_uri(dep)
71
+			name = parse_pkg_uri(dep)
60 72
 			known_libs.append(name)
61 73
 	return known_libs
62 74
 
@@ -64,7 +76,7 @@ def get_all_env_libs():
64 76
 	env_libs = []
65 77
 	lib_deps = env.GetProjectOption('lib_deps')
66 78
 	for dep in lib_deps:
67
-		name, _, _ = PackageManager.parse_pkg_uri(dep)
79
+		name = parse_pkg_uri(dep)
68 80
 		env_libs.append(name)
69 81
 	return env_libs
70 82
 
@@ -96,20 +108,20 @@ def apply_features_config():
96 108
 			# feat to add
97 109
 			deps_to_add = {}
98 110
 			for dep in feat['lib_deps']:
99
-				name, _, _ = PackageManager.parse_pkg_uri(dep)
111
+				name = parse_pkg_uri(dep)
100 112
 				deps_to_add[name] = dep
101 113
 
102 114
 			# Does the env already have the dependency?
103 115
 			deps = env.GetProjectOption('lib_deps')
104 116
 			for dep in deps:
105
-				name, _, _ = PackageManager.parse_pkg_uri(dep)
117
+				name = parse_pkg_uri(dep)
106 118
 				if name in deps_to_add:
107 119
 					del deps_to_add[name]
108 120
 
109 121
 			# Are there any libraries that should be ignored?
110 122
 			lib_ignore = env.GetProjectOption('lib_ignore')
111 123
 			for dep in deps:
112
-				name, _, _ = PackageManager.parse_pkg_uri(dep)
124
+				name = parse_pkg_uri(dep)
113 125
 				if name in deps_to_add:
114 126
 					del deps_to_add[name]
115 127
 

Loading…
Cancel
Save