From 954893b36cd09a037ae3ecf7a0c61d537c5a5b24 Mon Sep 17 00:00:00 2001 From: Evan Blaudy Date: Tue, 10 Oct 2023 02:04:09 +0200 Subject: [PATCH 1/6] Add python 3.12 to CI matrix Signed-off-by: Evan Blaudy --- .github/workflows/python-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 2b1ba9d61..3e69131cb 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -93,7 +93,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] include: - { os: ubuntu-latest, shell: bash } - { os: macos-latest, shell: bash } @@ -163,7 +163,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-build: ['cp37*', 'cp38*', 'cp39*', 'cp310*', 'cp311*'] + python-build: ['cp37*', 'cp38*', 'cp39*', 'cp310*', 'cp311*', 'cp312*'] steps: - uses: actions/checkout@v3 From 4ef96a843af804c9436de79fbd94775852c5839b Mon Sep 17 00:00:00 2001 From: Evan Blaudy Date: Tue, 10 Oct 2023 02:04:30 +0200 Subject: [PATCH 2/6] Stop using imp module it's deprecated since python 3.4 and removed in python 3.12 Signed-off-by: Evan Blaudy --- .../opentimelineio/plugins/python_plugin.py | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/py-opentimelineio/opentimelineio/plugins/python_plugin.py b/src/py-opentimelineio/opentimelineio/plugins/python_plugin.py index 7a5d3be27..e5b80979f 100644 --- a/src/py-opentimelineio/opentimelineio/plugins/python_plugin.py +++ b/src/py-opentimelineio/opentimelineio/plugins/python_plugin.py @@ -4,10 +4,10 @@ """Base class for OTIO plugins that are exposed by manifests.""" import os -import imp import inspect import collections import copy +import importlib.util from .. import ( core, @@ -107,21 +107,23 @@ def module_abs_path(self): def _imported_module(self, namespace): """Load the module this plugin points at.""" - pyname = os.path.splitext(os.path.basename(self.module_abs_path()))[0] - pydir = os.path.dirname(self.module_abs_path()) - - (file_obj, pathname, description) = imp.find_module(pyname, [pydir]) - - with file_obj: - # this will reload the module if it has already been loaded. - mod = imp.load_module( - f"opentimelineio.{namespace}.{self.name}", - file_obj, - pathname, - description + module_name = f"opentimelineio.{namespace}.{self.name}" + try: + # Attempt to import the module using importlib first + mod = importlib.import_module(module_name) + except ImportError: + # If the module couldn't be imported, import it manually + pyname = os.path.splitext(os.path.basename(self.module_abs_path()))[0] + pydir = os.path.dirname(self.module_abs_path()) + spec = importlib.util.spec_from_file_location( + module_name, + os.path.join(pydir, f"{pyname}.py"), ) - return mod + mod = importlib.util.module_from_spec(spec) + spec.loader.exec_module(mod) + + return mod def module(self): """Return the module object for this adapter. """ From 09a3532c561a7e48c2c06df579188aa4e89c787f Mon Sep 17 00:00:00 2001 From: Evan Blaudy Date: Sat, 28 Oct 2023 14:37:47 +0200 Subject: [PATCH 3/6] Fix AttributeError: 'VendorImporter' object has no attribute '_path' in Python 3.12 for autogen_serialized_datamodel.py Signed-off-by: Evan Blaudy --- .../opentimelineio/console/autogen_serialized_datamodel.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/py-opentimelineio/opentimelineio/console/autogen_serialized_datamodel.py b/src/py-opentimelineio/opentimelineio/console/autogen_serialized_datamodel.py index 0153afdd6..ca62f79bd 100644 --- a/src/py-opentimelineio/opentimelineio/console/autogen_serialized_datamodel.py +++ b/src/py-opentimelineio/opentimelineio/console/autogen_serialized_datamodel.py @@ -200,6 +200,7 @@ def _generate_model_for_module(mod, classes, modules): if ( inspect.ismodule(thing) and thing not in modules + and "opentimelineio" in thing.__name__ and all(not thing.__name__.startswith(t) for t in SKIP_MODULES) ) ), From bcc02acadf0d6d46b23a234baa862801c9f07455 Mon Sep 17 00:00:00 2001 From: Evan Blaudy Date: Sun, 29 Oct 2023 16:45:10 +0100 Subject: [PATCH 4/6] Update pybind11 submodule to latest tag (v2.11.1) Signed-off-by: Evan Blaudy --- src/deps/pybind11 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/deps/pybind11 b/src/deps/pybind11 index 4ce05175d..8a099e44b 160000 --- a/src/deps/pybind11 +++ b/src/deps/pybind11 @@ -1 +1 @@ -Subproject commit 4ce05175d51a4685232452bdc1e9cbb13a240a65 +Subproject commit 8a099e44b3d5f85b20f05828d919d2332a8de841 From 39e7be16122d156f26fb2fbfcfa85512f7a9246b Mon Sep 17 00:00:00 2001 From: Evan Blaudy Date: Mon, 30 Oct 2023 00:26:23 +0100 Subject: [PATCH 5/6] Fix opentimelineio.url_utils.filepath_from_url for windows URL in python 3.12 Signed-off-by: Evan Blaudy --- src/py-opentimelineio/opentimelineio/url_utils.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/py-opentimelineio/opentimelineio/url_utils.py b/src/py-opentimelineio/opentimelineio/url_utils.py index 61e44be58..d6c485917 100644 --- a/src/py-opentimelineio/opentimelineio/url_utils.py +++ b/src/py-opentimelineio/opentimelineio/url_utils.py @@ -10,8 +10,9 @@ request ) from pathlib import ( - Path, - PureWindowsPath + PurePath, + PureWindowsPath, + PurePosixPath ) @@ -21,7 +22,7 @@ def url_from_filepath(fpath): try: # appears to handle absolute windows paths better, which are absolute # and start with a drive letter. - return urlparse.unquote(Path(fpath).as_uri()) + return urlparse.unquote(PurePath(fpath).as_uri()) except ValueError: # scheme is "file" for absolute paths, else "" scheme = "file" if os.path.isabs(fpath) else "" @@ -56,16 +57,16 @@ def filepath_from_url(urlstr): parsed_result = urlparse.urlparse(urlstr) # Convert the parsed URL to a path - filepath = Path(request.url2pathname(parsed_result.path)) + filepath = PurePath(request.url2pathname(parsed_result.path)) # If the network location is a window drive, reassemble the path if PureWindowsPath(parsed_result.netloc).drive: - filepath = Path(parsed_result.netloc + parsed_result.path) + filepath = PurePath(parsed_result.netloc + parsed_result.path) # Otherwise check if the specified index is a windows drive, then offset the path elif PureWindowsPath(filepath.parts[1]).drive: # Remove leading "/" if/when `request.url2pathname` yields "/S:/path/file.ext" - filepath = filepath.relative_to(filepath.root) + filepath = PurePosixPath(*filepath.parts[1:]) # Convert "\" to "/" if needed return filepath.as_posix() From 9f40032edcd8f0a052af7f70bb64ec2669a9cec2 Mon Sep 17 00:00:00 2001 From: Evan Blaudy Date: Mon, 30 Oct 2023 12:55:44 +0100 Subject: [PATCH 6/6] In python-package.yml workflow upgrade pypa/cibuildwheel to v2.16.2 to support python 3.12 Signed-off-by: Evan Blaudy --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 3e69131cb..b7470bda8 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -168,7 +168,7 @@ jobs: - uses: actions/checkout@v3 - name: Build wheels (Python 3) - uses: pypa/cibuildwheel@v2.11.1 + uses: pypa/cibuildwheel@v2.16.2 with: output-dir: wheelhouse env: