22
22
http://arduino.cc/en/Reference/HomePage
23
23
"""
24
24
25
- import subprocess
26
- import json
27
25
import os
28
26
import sys
29
27
import shutil
34
32
from pathlib import Path
35
33
from typing import Union , List
36
34
37
- import semantic_version
38
35
from SCons .Script import DefaultEnvironment , SConscript
39
36
from platformio import fs
40
- from platformio .package .version import pepver_to_semver
41
37
from platformio .package .manager .tool import ToolPackageManager
42
38
43
39
IS_WINDOWS = sys .platform .startswith ("win" )
44
40
45
- python_deps = {
46
- "wheel" : ">=0.35.1" ,
47
- "rich-click" : ">=1.8.6" ,
48
- "PyYAML" : ">=6.0.2" ,
49
- "intelhex" : ">=2.3.0" ,
50
- "rich" : ">=14.0.0" ,
51
- "esp-idf-size" : ">=1.6.1"
52
- }
53
-
54
41
# Constants for better performance
55
42
UNICORE_FLAGS = {
56
43
"CORE32SOLO1" ,
@@ -601,53 +588,6 @@ def has_unicore_flags():
601
588
env .Replace (BUILD_UNFLAGS = new_build_unflags )
602
589
603
590
604
- def get_packages_to_install (deps , installed_packages ):
605
- """Generator for packages to install"""
606
- for package , spec in deps .items ():
607
- if package not in installed_packages :
608
- yield package
609
- else :
610
- version_spec = semantic_version .Spec (spec )
611
- if not version_spec .match (installed_packages [package ]):
612
- yield package
613
-
614
-
615
- def install_python_deps ():
616
- def _get_installed_pip_packages ():
617
- result = {}
618
- try :
619
- pip_output = subprocess .check_output ([
620
- env .subst ("$PYTHONEXE" ),
621
- "-m" , "pip" , "list" , "--format=json" ,
622
- "--disable-pip-version-check"
623
- ])
624
- packages = json .loads (pip_output )
625
- for p in packages :
626
- result [p ["name" ]] = pepver_to_semver (p ["version" ])
627
- except Exception :
628
- print ("Warning! Couldn't extract the list of installed Python "
629
- "packages." )
630
-
631
- return result
632
-
633
- installed_packages = _get_installed_pip_packages ()
634
- packages_to_install = list (get_packages_to_install (python_deps ,
635
- installed_packages ))
636
-
637
- if packages_to_install :
638
- packages_str = " " .join (f'"{ p } { python_deps [p ]} "'
639
- for p in packages_to_install )
640
- env .Execute (
641
- env .VerboseAction (
642
- f'"$PYTHONEXE" -m pip install -U -q -q -q { packages_str } ' ,
643
- "Installing Arduino Python dependencies" ,
644
- )
645
- )
646
-
647
-
648
- install_python_deps ()
649
-
650
-
651
591
def get_MD5_hash (phrase ):
652
592
return hashlib .md5 (phrase .encode ('utf-8' )).hexdigest ()[:16 ]
653
593
@@ -955,6 +895,7 @@ def get_frameworks_in_current_env():
955
895
956
896
if ("arduino" in pioframework and "espidf" not in pioframework and
957
897
arduino_lib_compile_flag in ("Inactive" , "True" )):
898
+
958
899
# try to remove not needed include path if an lib_ignore entry exists
959
900
from component_manager import ComponentManager
960
901
component_manager = ComponentManager (env )
@@ -965,8 +906,6 @@ def get_frameworks_in_current_env():
965
906
env .AddPostAction ("checkprogsize" , silent_action )
966
907
967
908
if IS_WINDOWS :
968
- # Smart include path optimization based on bleeding edge configurable
969
- # threshold
970
909
env .AddBuildMiddleware (smart_include_length_shorten )
971
910
972
911
build_script_path = join (FRAMEWORK_DIR , "tools" , "pioarduino-build.py" )
0 commit comments