def __init__(self, config): # attr self._config = config path_resolver = None validator = None loader = None # start info = Info() if not info.is_windows and not info.is_linux: raise BaseException('unsupported platform') # get binary path path_resolver = BinaryPathResolver(self._config) pathname = path_resolver.resolve() if not pathname: name = self._config['name'] raise BaseException(f'Please install {name} or add a custom path ' f'to {name} library binary ' f'in \'arena_api_config.py\'') # validate path # validate platform # validate version validator = BinaryValidator(self._config) validator.validate(pathname) # load loader = BinaryLoader(self._config) self.hbinary = loader.load(pathname)
def validate(self, pathname): version = self._get_version(pathname) info = Info() if info.is_arm: self._validate_arm(pathname, version) else: self._validate_linux(pathname, version)
def __init__(self, config): self._config = config self._info = None self._path_resolver = None self._info = Info() if self._info.is_windows: self._path_resolver = BinaryPathResolverWindows(self._config) elif self._info.is_linux: self._path_resolver = BinaryPathResolverLinux(self._config)
def resolve(self): info = Info() if info.is_py64: # 64 custom win if self._custom_pathname_r64: return self._custom_pathname_r64 # 64 installed win else: return self._installation_pathname_r64 else: # 32 custom win if self._custom_pathname_r32: return self._custom_pathname_r32 # 64 installed win else: return self._installation_pathname_r32
# 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. # ----------------------------------------------------------------------------- from ctypes import byref, create_string_buffer, create_unicode_buffer from arena_api._xlayer.info import Info from arena_api._xlayer.xsave.savec import hsavec from arena_api._xlayer.xsave.savec_types import (char_ptr, double, saveRecorder, size_t, uint8_t, uint64_t, wchar_ptr) from arena_api._xlayer.xsave.xsave_defaults import XSAVE_STR_BUF_SIZE_DEFAULT _info = Info() class xRecorder: ''' direct mapping for c functions exclude __init__ and __del__ ''' def __init__(self, width=None, height=None, fps=None): self.recorder = None self.hRecorder = None if all([width, height, fps]): # all param passed self.recorder = self._Create(width, height, fps) elif not any([width, height, fps]): # no param passed self.recorder = self._CreateEmpty()