Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.12 support #1898

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/rez/cli/selftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

import os
import sys
import importlib
import importlib.util
import inspect
import argparse
import shutil
Expand Down Expand Up @@ -56,7 +58,9 @@ def __call__(self, parser, namespace, values, option_string=None):
prefix = "test_"
for importer, name, ispkg in iter_modules([tests_dir]):
if not ispkg and name.startswith(prefix):
module = importer.find_module(name).load_module(name)
spec = importer.find_spec(name)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
name_ = name[len(prefix):]
all_module_tests.append(name_)
tests.append((name_, module))
Expand Down
5 changes: 3 additions & 2 deletions src/rez/plugin_managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from rez.utils.logging_ import print_debug, print_warning
from rez.exceptions import RezPluginError
from zipimport import zipimporter
import importlib.util
import pkgutil
import os.path
import sys
Expand Down Expand Up @@ -157,10 +158,10 @@ def load_plugins(self):
# https://github.com/AcademySoftwareFoundation/rez/pull/218
# load_module will force reload the module if it's
# already loaded, so check for that
# TODO: Confirm if the force reload still happens after this change.
plugin_module = sys.modules.get(modname)
if plugin_module is None:
loader = importer.find_module(modname)
plugin_module = loader.load_module(modname)
plugin_module = importlib.import_module(modname)

elif os.path.dirname(plugin_module.__file__) != path:
if config.debug("plugins"):
Expand Down
Loading