File tree Expand file tree Collapse file tree 6 files changed +166
-151
lines changed Expand file tree Collapse file tree 6 files changed +166
-151
lines changed Original file line number Diff line number Diff line change @@ -256,8 +256,9 @@ endif
256256
257257.PHONY : swig
258258swig : $(INC ) src/LavaVuPython.i | paths
259+ # NOTE: bug in swig requires pip install swig==4.2 until fixed
259260 swig -v -Wextra -python -py3 -ignoremissing -O -c++ -DSWIG_DO_NOT_WRAP -outdir $(PREFIX ) src/LavaVuPython.i
260- cd $(PREFIX ) /osmesa; ln -sf ../LavaVuPython.py ; touch __init__.py
261+ cd $(PREFIX ) /osmesa; touch __init__.py
261262
262263$(SWIGLIB ) : $(LIBRARY ) $(SWIGOBJ )
263264 -rm -f $(PREFIX ) /_LavaVuPython.*
Original file line number Diff line number Diff line change 55# the SWIG interface file instead.
66
77from sys import version_info as _swig_python_version_info
8- # Import the low-level C/C++ module
9- if __package__ or "." in __name__ :
10- from . import _LavaVuPython
8+
9+ import os
10+ if 'osmesa' in os .environ .get ('LV_CONTEXT' , '' ):
11+ from osmesa import _LavaVuPython
1112else :
1213 import _LavaVuPython
1314
15+
1416try :
1517 import builtins as __builtin__
1618except ImportError :
Original file line number Diff line number Diff line change 102102 context = 'moderngl'
103103 except Exception as e :
104104 context = 'osmesa'
105-
106- if context == 'osmesa' :
107- #OSMesa fallback, CPU only, multicore
108- from osmesa import LavaVuPython
105+ os .environ ['LV_CONTEXT' ] = context
109106
110107#Default module if none already loaded
111108try :
112109 LavaVuPython
113110except :
114111 import LavaVuPython
115112
116- os .environ ['LV_CONTEXT' ] = context
117-
118113version = LavaVuPython .version
119114server_ports = []
120115
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11/* ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*
22* LavaVu python interface
33**~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*/
4- %module LavaVuPython
4+ #%module LavaVuPython
5+ #%module (package=" mypackage" ) LavaVuPython
6+ #%module (package=" LavaVuPython" , moduleimport=" import $module" ) foo
7+ #%module (moduleimport=" from osmesa import _LavaVuPython" ) foo
8+
9+ %define MODULEIMPORT
10+ "
11+ import os
12+ if 'osmesa' in os.environ.get('LV_CONTEXT', ''):
13+ from osmesa import $module
14+ else:
15+ import $module
16+ "
17+ %enddef
18+
19+ %module (moduleimport=MODULEIMPORT) LavaVuPython
520
621%{
722#define SWIG_FILE_WITH_INIT
You can’t perform that action at this time.
0 commit comments