Add python3.12 compatability
* imp and find_loader got removed in py3.12 Signed-off-by: Alfred Wingate <parona@protonmail.com>
This commit is contained in:
		@@ -1,6 +1,6 @@
 | 
				
			|||||||
import os
 | 
					import os
 | 
				
			||||||
import sys
 | 
					import sys
 | 
				
			||||||
import imp
 | 
					import importlib
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import portage
 | 
					import portage
 | 
				
			||||||
from portage.const import VDB_PATH
 | 
					from portage.const import VDB_PATH
 | 
				
			||||||
@@ -56,7 +56,7 @@ def package_from_ebuild(ebuild):
 | 
				
			|||||||
                encoding=_encodings['content'], errors='strict')
 | 
					                encoding=_encodings['content'], errors='strict')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        portage.close_portdbapi_caches()
 | 
					        portage.close_portdbapi_caches()
 | 
				
			||||||
        imp.reload(portage)
 | 
					        importlib.reload(portage)
 | 
				
			||||||
    del portage.portdb.porttrees[1:]
 | 
					    del portage.portdb.porttrees[1:]
 | 
				
			||||||
    if ebuild_portdir != portage.portdb.porttree_root:
 | 
					    if ebuild_portdir != portage.portdb.porttree_root:
 | 
				
			||||||
        portage.portdb.porttrees.append(ebuild_portdir)
 | 
					        portage.portdb.porttrees.append(ebuild_portdir)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,7 +10,8 @@ handlers = {'package': [], 'url': [], 'all': {}}
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# autoimport all modules in this directory and append them to handlers list
 | 
					# autoimport all modules in this directory and append them to handlers list
 | 
				
			||||||
for loader, module_name, is_pkg in pkgutil.walk_packages(__path__):
 | 
					for loader, module_name, is_pkg in pkgutil.walk_packages(__path__):
 | 
				
			||||||
    module = loader.find_module(module_name).load_module(module_name)
 | 
					
 | 
				
			||||||
 | 
					    module = loader.find_spec(module_name).loader.load_module(module_name)
 | 
				
			||||||
    if not hasattr(module, 'HANDLER_NAME'):
 | 
					    if not hasattr(module, 'HANDLER_NAME'):
 | 
				
			||||||
        continue
 | 
					        continue
 | 
				
			||||||
    if hasattr(module, 'scan_url'):
 | 
					    if hasattr(module, 'scan_url'):
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user