On Sat, May 15, 2021 at 12:27:24PM +0200, Jeremie Courreges-Anglas wrote:
> On Sat, May 15 2021, Marc Espie <es...@nerim.net> wrote:
> > On Sat, May 15, 2021 at 10:45:19AM +0200, Omar Polo wrote:
> >> "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.
> >
> > Nope, there's about zero good reason. Oh well, that's python
> 
> I know I've had to change some ports to use the
> sys.platform.startswith("openbsd") idiom, indeed it's a bit silly.
> 
This would cope well if and when draco is ported to OpenBSD
I'm trying to do the same.

Build & Run tested on amd64.

regards,
  Dimitri

Index: Makefile
===================================================================
RCS file: /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    17 May 2021 06:48:57 -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
  17 May 2021 06:48:57 -0000
@@ -0,0 +1,29 @@
+$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
+@@ -46,11 +46,17 @@ def dll_path() -> Path:
+         'darwin': 'lib{}.dylib'.format(lib_name)
+     }.get(sys.platform)
+ 
+-    if path is None or library_name is None:
+-        print_console('WARNING', 'Unsupported platform {}, Draco mesh 
compression is unavailable'.format(sys.platform))
++    if sys.platform.startswith('openbsd'):
++        path = blender_root.parent / 'lib'
++        library_name = 'libdraco.so'
+ 
+-    return path / library_name
++    lib_file = sorted(Path(path).glob(library_name + '*'))
+ 
++    if not lib_file:
++        print_console('WARNING', 'Unsupported platform {}, Draco mesh 
compression is unavailable'.format(sys.platform))
++        return path / library_name
++    else:
++        return lib_file[-1]
+ 
+ def dll_exists(quiet=False) -> bool:
+     """

Reply via email to