Added an extension for libfastsolver and fix for loading so in Debian

This commit is contained in:
Dmitri Bogomolov 2018-06-27 11:55:07 +03:00
parent 7ad1725235
commit 976a2faa68
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13
2 changed files with 22 additions and 1 deletions

View File

@ -12,7 +12,7 @@ from src.version import softwareVersion
EXTRAS_REQUIRE = {
'gir': ['pygobject'],
'notify2': ['notify2'],
'pyopencl': ['pyopencl', 'numpy'],
'opencl': ['pyopencl', 'numpy'],
'prctl': ['python_prctl'], # Named threads
'qrcode': ['qrcode'],
'sound;platform_system=="Windows"': ['winsound'],
@ -50,6 +50,15 @@ if __name__ == "__main__":
with open(os.path.join(here, 'README.md')) as f:
README = f.read()
libfastsolver = Extension(
'pybitmessage.workprover.fastsolver.libfastsolver',
sources=[
'src/workprover/fastsolver/common.c',
'src/workprover/fastsolver/pthread.c'],
include_dirs=['src/workprover/fastsolver'],
libraries=['pthread', 'crypto'],
)
installRequires = []
packages = [
'pybitmessage',
@ -116,6 +125,7 @@ if __name__ == "__main__":
('share/icons/hicolor/24x24/apps/',
['desktop/icons/24x24/pybitmessage.png'])
],
ext_modules=[libfastsolver],
zip_safe=False,
entry_points={
'bitmessage.gui.menu': [

View File

@ -21,6 +21,17 @@ def loadFastSolver(codePath):
except:
raise FastSolverError()
# dh_python renames so
if platform.dist()[0] in ('debian', 'ubuntu'):
import glob
try:
return ctypes.CDLL(glob.glob(os.path.join(
codePath, "fastsolver",
"libfastsolver.{}*.so".format(platform.machine())
))[0])
except (OSError, IndexError):
pass
makePath = os.path.join(codePath, "fastsolver")
path = os.path.join(codePath, "fastsolver/libfastsolver.so")