mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
dist: Switch build_apps from pkg_resources to importlib.metadata
This commit is contained in:
parent
39e4e4167c
commit
36bcfe7705
22
direct/src/dist/commands.py
vendored
22
direct/src/dist/commands.py
vendored
@ -54,10 +54,16 @@ def _register_python_loaders():
|
|||||||
|
|
||||||
_register_python_loaders.done = True
|
_register_python_loaders.done = True
|
||||||
|
|
||||||
registry = p3d.LoaderFileTypeRegistry.getGlobalPtr()
|
from importlib.metadata import entry_points
|
||||||
|
|
||||||
import pkg_resources
|
eps = entry_points()
|
||||||
for entry_point in pkg_resources.iter_entry_points('panda3d.loaders'):
|
if isinstance(eps, dict): # Python 3.8 and 3.9
|
||||||
|
loaders = eps.get('panda3d.loaders', ())
|
||||||
|
else:
|
||||||
|
loaders = eps.select(group='panda3d.loaders')
|
||||||
|
|
||||||
|
registry = p3d.LoaderFileTypeRegistry.get_global_ptr()
|
||||||
|
for entry_point in loaders:
|
||||||
registry.register_deferred_type(entry_point)
|
registry.register_deferred_type(entry_point)
|
||||||
|
|
||||||
|
|
||||||
@ -1698,7 +1704,7 @@ class bdist_apps(setuptools.Command):
|
|||||||
setattr(self, opt, None)
|
setattr(self, opt, None)
|
||||||
|
|
||||||
def finalize_options(self):
|
def finalize_options(self):
|
||||||
import pkg_resources
|
from importlib.metadata import entry_points
|
||||||
|
|
||||||
# We need to massage the inputs a bit in case they came from a
|
# We need to massage the inputs a bit in case they came from a
|
||||||
# setup.cfg file.
|
# setup.cfg file.
|
||||||
@ -1712,11 +1718,17 @@ class bdist_apps(setuptools.Command):
|
|||||||
self.signing_certificate = os.path.abspath(self.signing_certificate)
|
self.signing_certificate = os.path.abspath(self.signing_certificate)
|
||||||
self.signing_private_key = os.path.abspath(self.signing_private_key)
|
self.signing_private_key = os.path.abspath(self.signing_private_key)
|
||||||
|
|
||||||
|
eps = entry_points()
|
||||||
|
if isinstance(eps, dict): # Python 3.8 and 3.9
|
||||||
|
installer_eps = eps.get('panda3d.bdist_apps.installers', ())
|
||||||
|
else:
|
||||||
|
installer_eps = eps.select(group='panda3d.bdist_apps.installers')
|
||||||
|
|
||||||
tmp = self.DEFAULT_INSTALLER_FUNCS.copy()
|
tmp = self.DEFAULT_INSTALLER_FUNCS.copy()
|
||||||
tmp.update(self.installer_functions)
|
tmp.update(self.installer_functions)
|
||||||
tmp.update({
|
tmp.update({
|
||||||
entrypoint.name: entrypoint.load()
|
entrypoint.name: entrypoint.load()
|
||||||
for entrypoint in pkg_resources.iter_entry_points('panda3d.bdist_apps.installers')
|
for entrypoint in installer_eps
|
||||||
})
|
})
|
||||||
self.installer_functions = tmp
|
self.installer_functions = tmp
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user