dist: Remove panda3d dependency for global dist hook

Fixes #1624
This commit is contained in:
rdb 2024-03-27 11:23:17 +01:00
parent aa58b4ccf2
commit 1f41edd0a0
2 changed files with 17 additions and 11 deletions

16
direct/src/dist/_dist_hooks.py vendored Normal file
View File

@ -0,0 +1,16 @@
# This module should not import Panda3D modules globally as it contains hooks
# that may be invoked by setuptools even when Panda3D is not used. If the
# Panda3D installation is broken, it should not affect other applications.
__all__ = ('finalize_distribution_options', )
def finalize_distribution_options(dist):
"""Entry point for compatibility with setuptools>=61, see #1394."""
options = dist.get_option_dict('build_apps')
if options.get('gui_apps') or options.get('console_apps'):
# Make sure this is set to avoid auto-discovery taking place.
if getattr(dist.metadata, 'py_modules', None) is None and \
getattr(dist.metadata, 'packages', None) is None:
dist.py_modules = []

View File

@ -25,6 +25,7 @@ import distutils.log
from . import FreezeTool
from . import pefile
from .icon import Icon
from ._dist_hooks import finalize_distribution_options
import panda3d.core as p3d
@ -1765,14 +1766,3 @@ class bdist_apps(setuptools.Command):
else:
self.announce('\tUnknown installer: {}'.format(installer), distutils.log.ERROR)
def finalize_distribution_options(dist):
"""Entry point for compatibility with setuptools>=61, see #1394."""
options = dist.get_option_dict('build_apps')
if options.get('gui_apps') or options.get('console_apps'):
# Make sure this is set to avoid auto-discovery taking place.
if getattr(dist.metadata, 'py_modules', None) is None and \
getattr(dist.metadata, 'packages', None) is None:
dist.py_modules = []