Skip to content
This repository has been archived by the owner on Dec 15, 2018. It is now read-only.

Commit

Permalink
Add hashing libs for more platforms
Browse files Browse the repository at this point in the history
Add hashing libs for FreeBSD, ARM, and 32-bit macOS/Windows.
  • Loading branch information
Noctem committed Nov 12, 2016
1 parent ceb8dd5 commit 6fe1d97
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 15 deletions.
Binary file added pgoapi/lib/libniantichash-freebsd-i386.so
Binary file not shown.
Binary file modified pgoapi/lib/libniantichash-freebsd-x86-64.so
Binary file not shown.
Binary file added pgoapi/lib/libniantichash-linux-arm32.so
Binary file not shown.
Binary file added pgoapi/lib/libniantichash-linux-arm64.so
Binary file not shown.
Binary file added pgoapi/lib/libniantichash-linux-i386.so
Binary file not shown.
Binary file added pgoapi/lib/libniantichash-macos-i386.dylib
Binary file not shown.
Binary file added pgoapi/lib/libniantichash-windows-i686.dll
Binary file not shown.
31 changes: 16 additions & 15 deletions pgoapi/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,30 +172,31 @@ def long_to_bytes(val, endianness='big'):
def get_hash_lib_path():
# win32 doesn't mean necessarily 32 bits
hash_lib = None
arch = platform.architecture()[0]
if sys.platform == "win32" or sys.platform == "cygwin":
if platform.architecture()[0] == '64bit':
if arch == '64bit':
hash_lib = "libniantichash-windows-x86-64.dll"
else:
hash_lib = "libniantichash-windows-i386.dll"
hash_lib = "libniantichash-windows-i686.dll"
elif sys.platform == "darwin":
hash_lib = "libniantichash-macos-x86-64.dylib"
elif os.uname()[4].startswith("arm") and platform.architecture()[0] == '32bit':
if arch == '64bit':
hash_lib = "libniantichash-macos-x86-64.dylib"
else:
hash_lib = "libniantichash-macos-i386.dylib"
elif os.uname()[4].startswith("arm") and arch == '32bit':
hash_lib = "libniantichash-linux-arm-32.so"
elif os.uname()[4].startswith("aarch64") and platform.architecture()[0] == '64bit':
elif os.uname()[4].startswith("aarch64") and arch == '64bit':
hash_lib = "libniantichash-linux-arm-64.so"
elif sys.platform.startswith('linux'):
if "centos" in platform.platform():
if platform.architecture()[0] == '64bit':
hash_lib = "libniantichash-centos-x86-64.so"
else:
hash_lib = "libniantichash-centos-i386.so"
if platform.architecture()[0] == '64bit':
hash_lib = "libniantichash-linux-x86-64.so"
else:
if platform.architecture()[0] == '64bit':
hash_lib = "libniantichash-linux-x86-64.so"
else:
hash_lib = "libniantichash-linux-i386.so"
hash_lib = "libniantichash-linux-i386.so"
elif sys.platform.startswith('freebsd'):
hash_lib = "libniantichash-freebsd-x86-64.so"
if arch == '64bit':
hash_lib = "libniantichash-freebsd-x86-64.so"
else:
hash_lib = "libniantichash-freebsd-i386.so"
else:
err = "Unexpected/unsupported platform '{}'".format(sys.platform)
log.error(err)
Expand Down

0 comments on commit 6fe1d97

Please sign in to comment.