@ -1,7 +1,7 @@
#!/usr/bin/env python3
#!/usr/bin/env python3
from ctypes import *
from ctypes import *
from sys import exit , platform
from sys import platform , exit
large_image1_path = " ../test_images/sample_01_large.jpg " . encode ( encoding = " utf-8 " )
large_image1_path = " ../test_images/sample_01_large.jpg " . encode ( encoding = " utf-8 " )
medium_image1_path = " ../test_images/sample_01_medium.jpg " . encode ( encoding = " utf-8 " )
medium_image1_path = " ../test_images/sample_01_medium.jpg " . encode ( encoding = " utf-8 " )
@ -26,24 +26,24 @@ test_images=[
large_image4_path , medium_image4_path , small_image4_path
large_image4_path , medium_image4_path , small_image4_path
]
]
def unsigned64 ( number ) :
def unsigned64 ( number ) :
return ( number & 0xfffffffffffffffff )
return ( number & 0xfffffffffffffffff )
print ( " starting ffi test " )
print ( " starting ffi test " )
# Load the shared library
# Load the shared library
lib = None
lib = None
if platform == ' win32 ' :
if platform == ' win32 ' :
path = os . path . dirname ( __file__ ) + " \\ pihash.dll "
print ( path )
lib = CDLL ( path )
lib = cdll . pihash
elif platform == ' darwin ' :
elif platform == ' darwin ' :
lib = cdll . LoadLibrary ( " libpihash.dylib " )
lib = cdll . LoadLibrary ( " libpihash.dylib " )
elif platform == ' linux ' or platform == ' linux2 ' :
elif platform == ' linux ' or platform == ' linux2 ' :
lib = cdll . LoadLibrary ( " libpihash.so " )
lib = cdll . LoadLibrary ( " libpihash.so " )
else :
else :
print ( ' Unrecognized platform ' , platform )
print ( ' Unrecognized platform ' , platform )
sys . exit ( - 1 )
exit ( - 1 )
class PIHashes ( Structure ) :
class PIHashes ( Structure ) :