diff --git a/direct/src/showbase/Loader.py b/direct/src/showbase/Loader.py index b43b2adb45..141c71a368 100644 --- a/direct/src/showbase/Loader.py +++ b/direct/src/showbase/Loader.py @@ -25,6 +25,7 @@ from panda3d.core import Loader as PandaLoader from direct.directnotify.DirectNotifyGlobal import directNotify from direct.showbase.DirectObject import DirectObject import warnings +import sys # You can specify a phaseChecker callback to check # a modelPath to see if it is being loaded in the correct @@ -153,10 +154,10 @@ class Loader(DirectObject): from importlib.metadata import entry_points eps = entry_points() - if isinstance(eps, dict): # Python 3.8 and 3.9 + if sys.version_info < (3, 10): loaders = eps.get('panda3d.loaders', ()) else: - loaders = entry_points().select(group='panda3d.loaders') + loaders = eps.select(group='panda3d.loaders') if loaders: registry = LoaderFileTypeRegistry.getGlobalPtr() diff --git a/makepanda/test_wheel.py b/makepanda/test_wheel.py index 8742c8df6f..350f420eab 100755 --- a/makepanda/test_wheel.py +++ b/makepanda/test_wheel.py @@ -59,7 +59,22 @@ def test_wheel(wheel, verbose=False): if verbose: test_cmd.append("--verbose") - exit_code = subprocess.call(test_cmd) + # Put the location of the python DLL on the path, for deploy-stub test + # This is needed because venv does not install a copy of the python DLL + env = None + if sys.platform == "win32": + deploy_libs = os.path.join(envdir, "Lib", "site-packages", "deploy_libs") + if os.path.isdir(deploy_libs): + # We have to do this dance because os.environ is case insensitive + env = dict(os.environ) + for key, value in env.items(): + if key.upper() == "PATH": + env[key] = deploy_libs + ";" + value + break + else: + env["PATH"] = deploy_libs + + exit_code = subprocess.call(test_cmd, env=env) shutil.rmtree(envdir) if exit_code != 0: diff --git a/setup.cfg b/setup.cfg index c51eeef48f..f67637e357 100644 --- a/setup.cfg +++ b/setup.cfg @@ -18,6 +18,7 @@ classifiers = Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 Programming Language :: Python :: Implementation :: CPython Topic :: Games/Entertainment Topic :: Multimedia diff --git a/tests/dist/test_FreezeTool.py b/tests/dist/test_FreezeTool.py index 9484e45451..e0eb82b7a5 100644 --- a/tests/dist/test_FreezeTool.py +++ b/tests/dist/test_FreezeTool.py @@ -89,6 +89,7 @@ def test_Freezer_generateRuntimeFromStub(tmp_path, use_console): target = str(tmp_path / ('stubtest' + suffix)) freezer = Freezer() + freezer.addModule('site', filename='site.py', text='import sys\nsys.frozen=True') freezer.addModule('module2', filename='module2.py', text='print("Module imported")') freezer.addModule('__main__', filename='main.py', text='import module2\nprint("Hello world")') assert '__main__' in freezer.modules