File tree 1 file changed +22
-3
lines changed
1 file changed +22
-3
lines changed Original file line number Diff line number Diff line change 13
13
14
14
import platform
15
15
import ctypes as ct
16
+ import traceback
17
+ import os
16
18
17
19
c_float_t = ct .c_float
18
20
c_double_t = ct .c_double
32
34
33
35
34
36
AF_VER_MAJOR = '3'
35
- FORGE_VER_MAJOR = '0 '
37
+ FORGE_VER_MAJOR = '1 '
36
38
37
39
# Work around for unexpected architectures
38
40
if 'c_dim_t_forced' in globals ():
@@ -424,7 +426,6 @@ class CANNY_THRESHOLD(_Enum):
424
426
425
427
def _setup ():
426
428
import platform
427
- import os
428
429
429
430
platform_name = platform .system ()
430
431
@@ -545,10 +546,23 @@ def __init__(self):
545
546
546
547
# Try to pre-load forge library if it exists
547
548
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
+
548
556
for libname in libnames :
549
557
try :
550
558
ct .cdll .LoadLibrary (libname )
559
+ if VERBOSE_LOADS :
560
+ print ('Loaded ' + libname )
561
+ break
551
562
except OSError :
563
+ if VERBOSE_LOADS :
564
+ traceback .print_exc ()
565
+ print ('Unable to load ' + libname )
552
566
pass
553
567
554
568
c_dim4 = c_dim_t * 4
@@ -568,8 +582,13 @@ def __init__(self):
568
582
if (err == ERR .NONE .value ):
569
583
self .__name = __name
570
584
clib .af_release_array (out )
571
- break ;
585
+ if VERBOSE_LOADS :
586
+ print ('Loaded ' + libname )
587
+ break ;
572
588
except OSError :
589
+ if VERBOSE_LOADS :
590
+ traceback .print_exc ()
591
+ print ('Unable to load ' + libname )
573
592
pass
574
593
575
594
if (self .__name is None ):
You can’t perform that action at this time.
0 commit comments