Avoid recursion when trying to build bitmsghash lib
in environments where prebuilt one is unusable and make doesn't work.
This commit is contained in:
parent
06ed879fca
commit
f28935f8fe
|
@ -5,11 +5,11 @@ Proof of work calculation
|
||||||
|
|
||||||
import ctypes
|
import ctypes
|
||||||
import os
|
import os
|
||||||
|
import subprocess # nosec B404
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import time
|
import time
|
||||||
from struct import pack, unpack
|
from struct import pack, unpack
|
||||||
from subprocess import call # nosec B404
|
|
||||||
|
|
||||||
import highlevelcrypto
|
import highlevelcrypto
|
||||||
import openclpow
|
import openclpow
|
||||||
|
@ -278,18 +278,26 @@ def buildCPoW():
|
||||||
try:
|
try:
|
||||||
if "bsd" in sys.platform:
|
if "bsd" in sys.platform:
|
||||||
# BSD make
|
# BSD make
|
||||||
call(["make", "-C", os.path.join(paths.codePath(), "bitmsghash"),
|
subprocess.check_call([ # nosec B607, B603
|
||||||
'-f', 'Makefile.bsd']) # nosec B607, B603
|
"make", "-C", os.path.join(paths.codePath(), "bitmsghash"),
|
||||||
|
'-f', 'Makefile.bsd'])
|
||||||
else:
|
else:
|
||||||
# GNU make
|
# GNU make
|
||||||
call([ # nosec B607, B603
|
subprocess.check_call([ # nosec B607, B603
|
||||||
"make", "-C", os.path.join(paths.codePath(), "bitmsghash")])
|
"make", "-C", os.path.join(paths.codePath(), "bitmsghash")])
|
||||||
if os.path.exists(os.path.join(paths.codePath(), "bitmsghash", "bitmsghash.so")):
|
if os.path.exists(
|
||||||
|
os.path.join(paths.codePath(), "bitmsghash", "bitmsghash.so")
|
||||||
|
):
|
||||||
init()
|
init()
|
||||||
notifyBuild(True)
|
notifyBuild(True)
|
||||||
else:
|
else:
|
||||||
notifyBuild(True)
|
notifyBuild(True)
|
||||||
|
except (OSError, subprocess.CalledProcessError):
|
||||||
|
notifyBuild(True)
|
||||||
except: # noqa:E722
|
except: # noqa:E722
|
||||||
|
logger.warning(
|
||||||
|
'Unexpected exception rised when tried to build bitmsghash lib',
|
||||||
|
exc_info=True)
|
||||||
notifyBuild(True)
|
notifyBuild(True)
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user