@@ -96,29 +96,16 @@ def setup_python_paths(env):
9696 add_to_pythonpath (python_dir )
9797
9898 # Try to find site-packages directory using the actual Python executable
99- try :
100- result = subprocess .run (
101- [python_exe , "-c" , "import site; print(site.getsitepackages()[0])" ],
102- capture_output = True ,
103- text = True ,
104- timeout = 5
105- )
106- if result .returncode == 0 :
107- site_packages = result .stdout .strip ()
108- if os .path .isdir (site_packages ):
109- add_to_pythonpath (site_packages )
110- except (subprocess .TimeoutExpired , FileNotFoundError , Exception ):
111- # Fallback: try common site-packages locations
112- possible_paths = [
113- os .path .join (python_dir , "Lib" , "site-packages" ), # Windows
114- os .path .join (python_dir , ".." , "lib" , f"python{ sys .version_info .major } .{ sys .version_info .minor } " , "site-packages" ), # Unix
115- ]
116-
117- for path in possible_paths :
118- normalized_path = os .path .normpath (path )
119- if os .path .isdir (normalized_path ):
120- add_to_pythonpath (normalized_path )
121- break
99+ result = subprocess .run (
100+ [python_exe , "-c" , "import site; print(site.getsitepackages()[0])" ],
101+ capture_output = True ,
102+ text = True ,
103+ timeout = 5
104+ )
105+ if result .returncode == 0 :
106+ site_packages = result .stdout .strip ()
107+ if os .path .isdir (site_packages ):
108+ add_to_pythonpath (site_packages )
122109
123110# Setup Python paths based on the actual Python executable
124111setup_python_paths (env )
@@ -658,6 +645,22 @@ def check_lib_archive_exists():
658645 return False
659646
660647
648+ def switch_off_ldf ():
649+ """
650+ Disables LDF (Library Dependency Finder) for uploadfs, uploadfsota, and buildfs targets.
651+
652+ This optimization prevents unnecessary library dependency scanning and compilation
653+ when only filesystem operations are performed.
654+ """
655+ fs_targets = {"uploadfs" , "uploadfsota" , "buildfs" }
656+ if fs_targets & set (COMMAND_LINE_TARGETS ):
657+ # Disable LDF by modifying project configuration directly
658+ env_section = "env:" + env ["PIOENV" ]
659+ if not projectconfig .has_section (env_section ):
660+ projectconfig .add_section (env_section )
661+ projectconfig .set (env_section , "lib_ldf_mode" , "off" )
662+
663+
661664# Initialize board configuration and MCU settings
662665board = env .BoardConfig ()
663666mcu = board .get ("build.mcu" , "esp32" )
@@ -801,6 +804,10 @@ def check_lib_archive_exists():
801804 env .SConscript ("frameworks/_bare.py" , exports = "env" )
802805
803806
807+ # Disable LDF for filesystem operations
808+ switch_off_ldf ()
809+
810+
804811def firmware_metrics (target , source , env ):
805812 """
806813 Custom target to run esp-idf-size with support for command line parameters.
0 commit comments