2015-11-03 04:38:59 -06:00
|
|
|
from __future__ import absolute_import
|
2014-10-27 16:29:04 -06:00
|
|
|
import ctypes
|
|
|
|
import os
|
|
|
|
import types
|
|
|
|
from platform_utils import paths
|
|
|
|
|
2015-11-03 04:38:59 -06:00
|
|
|
def load_library(libname, cdll=False):
|
2014-10-27 16:29:04 -06:00
|
|
|
if paths.is_frozen():
|
|
|
|
libfile = os.path.join(paths.embedded_data_path(), 'accessible_output2', 'lib', libname)
|
|
|
|
else:
|
|
|
|
libfile = os.path.join(paths.module_path(), 'lib', libname)
|
2015-11-03 04:38:59 -06:00
|
|
|
if cdll:
|
|
|
|
return ctypes.cdll[libfile]
|
|
|
|
else:
|
|
|
|
return ctypes.windll[libfile]
|
2014-10-27 16:29:04 -06:00
|
|
|
|
|
|
|
def get_output_classes():
|
2015-11-03 04:38:59 -06:00
|
|
|
from . import outputs
|
2014-10-27 16:29:04 -06:00
|
|
|
module_type = types.ModuleType
|
2015-11-03 04:38:59 -06:00
|
|
|
classes = [m.output_class for m in outputs.__dict__.values() if type(m) == module_type and hasattr(m, 'output_class')]
|
2014-10-27 16:29:04 -06:00
|
|
|
return sorted(classes, key=lambda c: c.priority)
|
|
|
|
|
|
|
|
def find_datafiles():
|
|
|
|
import os
|
|
|
|
import platform
|
|
|
|
from glob import glob
|
|
|
|
import accessible_output2
|
|
|
|
if platform.system() != 'Windows':
|
|
|
|
return []
|
|
|
|
path = os.path.join(accessible_output2.__path__[0], 'lib', '*.dll')
|
|
|
|
results = glob(path)
|
|
|
|
dest_dir = os.path.join('accessible_output2', 'lib')
|
|
|
|
return [(dest_dir, results)]
|