|
@@ -1,7 +1,19 @@
|
1
|
1
|
import os,shutil
|
2
|
2
|
from SCons.Script import DefaultEnvironment
|
3
|
3
|
from platformio import util
|
4
|
|
-from platformio.managers.package import PackageManager
|
|
4
|
+try:
|
|
5
|
+ # PIO < 4.4
|
|
6
|
+ from platformio.managers.package import PackageManager
|
|
7
|
+except ImportError:
|
|
8
|
+ # PIO >= 4.4
|
|
9
|
+ from platformio.package.meta import PackageSpec as PackageManager
|
|
10
|
+
|
|
11
|
+def parse_pkg_uri(spec):
|
|
12
|
+ if PackageManager.__name__ == 'PackageSpec':
|
|
13
|
+ return PackageManager(spec).name
|
|
14
|
+ else:
|
|
15
|
+ name, _, _ = PackageManager.parse_pkg_uri(spec)
|
|
16
|
+ return name
|
5
|
17
|
|
6
|
18
|
def copytree(src, dst, symlinks=False, ignore=None):
|
7
|
19
|
for item in os.listdir(src):
|
|
@@ -26,7 +38,7 @@ framewords = {
|
26
|
38
|
if len(platform_packages) == 0:
|
27
|
39
|
platform_name = framewords[platform.__class__.__name__]
|
28
|
40
|
else:
|
29
|
|
- platform_name, _, _ = PackageManager.parse_pkg_uri(platform_packages[0])
|
|
41
|
+ platform_name = parse_pkg_uri(platform_packages[0])
|
30
|
42
|
|
31
|
43
|
FRAMEWORK_DIR = platform.get_package_dir(platform_name)
|
32
|
44
|
assert os.path.isdir(FRAMEWORK_DIR)
|