20
20
21
21
from platformio .public import PlatformBase , to_unix_path
22
22
from platformio .proc import get_pythonexe_path
23
- from platformio .package . manager . tool import ToolPackageManager
23
+ from platformio .project . config import ProjectConfig
24
24
25
25
python_exe = get_pythonexe_path ()
26
- pm = ToolPackageManager ()
27
- IS_WINDOWS = sys .platform .startswith ("win" )
26
+
28
27
IDF_TOOLS_PATH_DEFAULT = os .path .join (os .path .expanduser ("~" ), ".espressif" )
29
- try :
30
- tl_path = pm .get_package ("tl-install" ).path
31
- IDF_TOOLS = os .path .join (tl_path , "tools" , "idf_tools.py" )
32
- except :
33
- IDF_TOOLS = ""
28
+ IDF_TOOLS = os .path .join (ProjectConfig .get_instance ().get ("platformio" , "packages_dir" ), "tl-install" , "tools" , "idf_tools.py" )
34
29
IDF_TOOLS_FLAG = ["install" ]
35
30
IDF_TOOLS_CMD = [python_exe , IDF_TOOLS ] + IDF_TOOLS_FLAG
36
31
37
-
38
32
class Espressif32Platform (PlatformBase ):
39
33
def configure_default_packages (self , variables , targets ):
40
34
if not variables .get ("board" ):
@@ -43,22 +37,20 @@ def configure_default_packages(self, variables, targets):
43
37
board_config = self .board_config (variables .get ("board" ))
44
38
mcu = variables .get ("board_build.mcu" , board_config .get ("build.mcu" , "esp32" ))
45
39
frameworks = variables .get ("pioframework" , [])
46
- try :
47
- tl_flag = bool (pm .get_package ("tl-install" ).path )
48
- except :
49
- tl_flag = False
40
+ tl_flag = bool (os .path .exists (IDF_TOOLS ))
50
41
51
42
# IDF Install is needed only one time
52
43
if not os .path .exists (join (IDF_TOOLS_PATH_DEFAULT , "tools" )) and tl_flag :
53
44
rc = subprocess .call (IDF_TOOLS_CMD )
54
45
if rc != 0 :
55
- sys .stderr .write ("Error: Couldn't execute 'idf_tools.py install' \n " )
46
+ sys .stderr .write ("Error: Couldn't execute 'idf_tools.py install'\n " )
56
47
else :
57
48
shutil .copytree (join (IDF_TOOLS_PATH_DEFAULT , "tools" , "tool-packages" ), join (IDF_TOOLS_PATH_DEFAULT , "tools" ), symlinks = False , ignore = None , ignore_dangling_symlinks = False , dirs_exist_ok = True )
58
49
59
50
if tl_flag :
60
- # Install all tools and toolchains
51
+ # install tool is not needed anymore
61
52
self .packages ["tl-install" ]["optional" ] = True
53
+ # Install all tools and toolchains
62
54
for p in self .packages :
63
55
if p in ("tool-mklittlefs" , "tool-mkfatfs" , "tool-mkspiffs" , "tool-dfuutil" , "tool-openocd" , "tool-cmake" , "tool-ninja" , "tool-cppcheck" , "tool-clangtidy" , "tool-pvs-studio" , "contrib-piohome" , "contrib-pioremote" , "tc-ulp" , "tc-rv32" , "tl-xt-gdb" , "tl-rv-gdb" ):
64
56
tl_path = "file://" + join (IDF_TOOLS_PATH_DEFAULT , "tools" , p )
@@ -70,7 +62,7 @@ def configure_default_packages(self, variables, targets):
70
62
self .packages [p ]["optional" ] = False if "espidf" in frameworks else True
71
63
# Enabling of following tools is not needed, installing is enough
72
64
for p in self .packages :
73
- if p in ("contrib-pioremote" , "contrib-piohome" , "tool-scons" ):
65
+ if p in ("contrib-pioremote" , "contrib-piohome" ):
74
66
try :
75
67
pkg_dir = pm .get_package (p ).path
76
68
# When package is not found an execption happens -> install is forced
0 commit comments