# # This file is part of Magnum. # # Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, # 2020, 2021, 2022, 2023, 2024 # Vladimír Vondruš # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. # """Root Corrade module""" # If MAGNUM_BUILD_PYTHON_BINDINGS_RTLD_GLOBAL is enabled in CMake, the lines # below are included, otherwise they are commented out. What it does is a # futile attempt to make Corrade (and Magnum) built as static libraries work # together when built into multiple dynamic Python modules. ${_MAGNUM_BUILD_PYTHON_BINDINGS_RTLD_GLOBAL}import sys ${_MAGNUM_BUILD_PYTHON_BINDINGS_RTLD_GLOBAL}import ctypes ${_MAGNUM_BUILD_PYTHON_BINDINGS_RTLD_GLOBAL}sys.setdlopenflags(sys.getdlopenflags()|ctypes.RTLD_GLOBAL) # On Windows, if a known directory layout is detected, add paths containing # binaries to the DLL search path import platform if platform.system() == 'Windows': import os for directory in [ # Prebuilt binaries from the magnum-ci repo have this file in # python/corrade/ and DLLs in bin/ '../../bin' ]: bin_path = os.path.join(os.path.dirname(__file__), directory) if os.path.exists(bin_path): os.add_dll_directory(bin_path) break from _corrade import * import sys # In case Corrade is built statically, the whole core project is put into # _corrade. The following feels extremely hackish, but without that it wouldn't # be possible to do `import corrade.containers`, which is weird # (`from corrade import containers` works, tho, for whatever reason) for i in ['containers', 'pluginmanager', 'utility']: if i in globals(): sys.modules['corrade.' + i] = globals()[i] # Just to not have the variable leak into stubs generated by pybind11-stubgen # TODO any way to exclude it? del i # Prevent all submodules being pulled in when saying `from corrade import *` -- # this is consistent with behavior in magnum __all__ = [ # TARGET_*, BUILD_* are omitted as `from corrade import *` would pull them # to globals and this would likely cause conflicts (magnum also defines # BUILD_*) ] # kate: hl python