3030 save_profile_yaml ,
3131 save_state_yaml ,
3232 validate_config ,
33+ load_blacklist_yaml ,
34+ save_blacklist_yaml ,
3335)
3436from .utils import expanduser , fix_perms , get_context , switch_priviledge
3537
@@ -142,6 +144,14 @@ def main():
142144 except Exception :
143145 pass
144146
147+ # Remove old dir
148+ try :
149+ os .rename (
150+ join (hhd_dir , "plugins" ), join (hhd_dir , "plugins_old_USE_STATEYML" )
151+ )
152+ except Exception :
153+ pass
154+
145155 set_log_plugin ("main" )
146156 setup_logger (join (CONFIG_DIR , "log" ), ctx = ctx )
147157
@@ -152,12 +162,27 @@ def main():
152162 else :
153163 logger .error (f"Command '{ args .command [0 ]} ' is unknown. Ignoring..." )
154164
165+ # Use blacklist
166+ blacklist_fn = join (hhd_dir , "plugins.yml" )
167+ blacklist = load_blacklist_yaml (blacklist_fn )
168+
169+ logger .info (f"Running autodetection..." )
170+
171+ detector_names = []
155172 for autodetect in pkg_resources .iter_entry_points ("hhd.plugins" ):
156- detectors [autodetect .name ] = autodetect .resolve ()
173+ name = autodetect .name
174+ detector_names .append (name )
175+ if name in blacklist :
176+ logger .info (f"Skipping blacklisted provider '{ name } '." )
177+ else :
178+ detectors [autodetect .name ] = autodetect .resolve ()
179+
180+ # Save new blacklist file
181+ save_blacklist_yaml (blacklist_fn , detector_names , blacklist )
182+ fix_perms (blacklist_fn , ctx )
157183
158184 logger .info (f"Found plugin providers: { ', ' .join (list (detectors ))} " )
159185
160- logger .info (f"Running autodetection..." )
161186 for name , autodetect in detectors .items ():
162187 plugins [name ] = autodetect ([])
163188
0 commit comments