@@ -224,18 +224,20 @@ def _is_tag_managed(company_key, tag_name, *, creating=False, allow_warn=True):
224224def _split_root (root_name ):
225225 if not root_name :
226226 LOGGER .verbose ("Skipping registry shortcuts as PEP 514 registry root is not set." )
227- return
227+ return None , None
228228 hive_name , _ , name = root_name .partition ("\\ " )
229229 try :
230230 hive = getattr (winreg , hive_name .upper ())
231231 except AttributeError :
232- LOGGER .verbose ("Skipping registry shortcuts as %s\\ %s is not a valid key" , root_name )
233- return
232+ LOGGER .verbose ("Skipping registry shortcuts as %s\\ %s is not a valid key" , root_name , hive_name )
233+ return None , None
234234 return hive , name
235235
236236
237237def update_registry (root_name , install , data , warn_for = []):
238238 hive , name = _split_root (root_name )
239+ if not hive or not name :
240+ return
239241 with winreg .CreateKey (hive , name ) as root :
240242 allow_warn = install_matches_any (install , warn_for )
241243 if _is_tag_managed (root , data ["Key" ], creating = True , allow_warn = allow_warn ):
@@ -258,6 +260,8 @@ def update_registry(root_name, install, data, warn_for=[]):
258260def cleanup_registry (root_name , keep , warn_for = []):
259261 LOGGER .debug ("Cleaning up registry entries" )
260262 hive , name = _split_root (root_name )
263+ if not hive or not name :
264+ return
261265 with _reg_open (hive , name , writable = True ) as root :
262266 for company_name in list (_iter_keys (root )):
263267 any_left = False
0 commit comments