File tree Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Original file line number Diff line number Diff line change 1313
1414import platform
1515import ctypes as ct
16+ import traceback
17+ import os
1618
1719c_float_t = ct .c_float
1820c_double_t = ct .c_double
3234
3335
3436AF_VER_MAJOR = '3'
35- FORGE_VER_MAJOR = '0 '
37+ FORGE_VER_MAJOR = '1 '
3638
3739# Work around for unexpected architectures
3840if 'c_dim_t_forced' in globals ():
@@ -424,7 +426,6 @@ class CANNY_THRESHOLD(_Enum):
424426
425427def _setup ():
426428 import platform
427- import os
428429
429430 platform_name = platform .system ()
430431
@@ -545,10 +546,23 @@ def __init__(self):
545546
546547 # Try to pre-load forge library if it exists
547548 libnames = self .__libname ('forge' , head = '' , ver_major = FORGE_VER_MAJOR )
549+
550+ try :
551+ VERBOSE_LOADS = os .environ ['AF_VERBOSE_LOADS' ] == '1'
552+ except KeyError :
553+ VERBOSE_LOADS = False
554+ pass
555+
548556 for libname in libnames :
549557 try :
550558 ct .cdll .LoadLibrary (libname )
559+ if VERBOSE_LOADS :
560+ print ('Loaded ' + libname )
561+ break
551562 except OSError :
563+ if VERBOSE_LOADS :
564+ traceback .print_exc ()
565+ print ('Unable to load ' + libname )
552566 pass
553567
554568 c_dim4 = c_dim_t * 4
@@ -568,8 +582,13 @@ def __init__(self):
568582 if (err == ERR .NONE .value ):
569583 self .__name = __name
570584 clib .af_release_array (out )
571- break ;
585+ if VERBOSE_LOADS :
586+ print ('Loaded ' + libname )
587+ break ;
572588 except OSError :
589+ if VERBOSE_LOADS :
590+ traceback .print_exc ()
591+ print ('Unable to load ' + libname )
573592 pass
574593
575594 if (self .__name is None ):
You can’t perform that action at this time.
0 commit comments