Marc Espie <[email protected]> writes:
> On Sat, May 15, 2021 at 10:11:51AM +0200, Omar Polo wrote:
>> Hello,
>>
>> Currently, blender fails to export as GLTF2:
>>
>> 07:59:45 | WARNING: Unsupported platform openbsd6, Draco mesh compression is
>> unavailable
>> Python: Traceback (most recent call last):
>> File "/usr/local/share/blender/scripts/addons/io_scene_gltf2/__init__.py",
>> line 116, in __init__
>> self.is_draco_available =
>> gltf2_io_draco_compression_extension.dll_exists()
>> File
>> "/usr/local/share/blender/scripts/addons/io_scene_gltf2/io/com/gltf2_io_draco_compression_extension.py",
>> line 62, in dll_exists
>> exists = dll_path().exists()
>> File
>> "/usr/local/share/blender/scripts/addons/io_scene_gltf2/io/com/gltf2_io_draco_compression_extension.py",
>> line 54, in dll_path
>> return path / library_name
>> TypeError: unsupported operand type(s) for /: 'NoneType' and 'NoneType'
>>
>> This is because of a couple of lookups table per-OS, so simply adding
>> "openbsd6" fixes it, even if we don't have this draco compression
>> library (AFAICS.)
>
> Is there a way to not be known as openbsd6 ? since we don't really have
> major versions.
"openbsd6" comes directly from python' sys.platform. I find that
strange too, but I assume it's for a good reason. Python (and python
porting) is not really my area of expertise.
--
I did a quick grep on the port tree out of curiosity and it seems that
other ports[0] with patches for python-stuff have cases for multiple
openbsd "version" (i.e. openbsd5, openbsd6, openbsd7...), so here's an
updated patch that also adds openbsd7
Cheers,
Omar Polo
[0]: like devel/gyp/patches/patch-gyptest_py
or graphics/py-opengl/patches/patch-OpenGL___init___py
and others.
Index: Makefile
===================================================================
RCS file: /home/cvs/ports/graphics/blender/Makefile,v
retrieving revision 1.103
diff -u -p -r1.103 Makefile
--- Makefile 27 Mar 2021 15:15:06 -0000 1.103
+++ Makefile 15 May 2021 07:43:41 -0000
@@ -6,6 +6,7 @@ DPB_PROPERTIES = parallel
COMMENT = 3D creation software
DISTNAME = blender-2.92.0
+REVISION = 0
CATEGORIES = graphics
Index:
patches/patch-release_scripts_addons_io_scene_gltf2_io_com_gltf2_io_draco_compression_extension_py
===================================================================
RCS file:
patches/patch-release_scripts_addons_io_scene_gltf2_io_com_gltf2_io_draco_compression_extension_py
diff -N
patches/patch-release_scripts_addons_io_scene_gltf2_io_com_gltf2_io_draco_compression_extension_py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++
patches/patch-release_scripts_addons_io_scene_gltf2_io_com_gltf2_io_draco_compression_extension_py
15 May 2021 08:41:11 -0000
@@ -0,0 +1,26 @@
+$OpenBSD$
+
+Fix the GLTF2 exporter crash: even if we don't have the draco
+compression library, avoid path and library_name being None.
+
+Index:
release/scripts/addons/io_scene_gltf2/io/com/gltf2_io_draco_compression_extension.py
+---
release/scripts/addons/io_scene_gltf2/io/com/gltf2_io_draco_compression_extension.py.orig
++++
release/scripts/addons/io_scene_gltf2/io/com/gltf2_io_draco_compression_extension.py
+@@ -35,6 +35,8 @@ def dll_path() -> Path:
+ path = {
+ 'win32': blender_root / python_lib / 'site-packages',
+ 'linux': blender_root / python_lib / python_version /
'site-packages',
++ 'openbsd6': blender_root / python_lib / python_version /
'site-packages',
++ 'openbsd7': blender_root / python_lib / python_version /
'site-packages',
+ 'darwin': blender_root.parent / 'Resources' / python_lib /
python_version / 'site-packages'
+ }.get(sys.platform)
+ else:
+@@ -43,6 +45,8 @@ def dll_path() -> Path:
+ library_name = {
+ 'win32': '{}.dll'.format(lib_name),
+ 'linux': 'lib{}.so'.format(lib_name),
++ 'openbsd6': 'lib{}.so'.format(lib_name),
++ 'openbsd7': 'lib{}.so'.format(lib_name),
+ 'darwin': 'lib{}.dylib'.format(lib_name)
+ }.get(sys.platform)
+