Fix Py2Exe / Py2App
Fixes the C PoW loading in frozen apps (Windows and OSX) Cleaner fallback in PoW if something goes wrong
This commit is contained in:
parent
03f709b70d
commit
12878af41f
|
@ -10,7 +10,12 @@ import openclpow
|
||||||
import os
|
import os
|
||||||
import ctypes
|
import ctypes
|
||||||
|
|
||||||
curdir = os.path.dirname(__file__)
|
if frozen == "macosx_app":
|
||||||
|
curdir = os.environ.get("RESOURCEPATH")
|
||||||
|
elif frozen: # windows
|
||||||
|
curdir = sys._MEIPASS
|
||||||
|
else:
|
||||||
|
curdir = os.path.dirname(__file__)
|
||||||
bitmsglib = 'bitmsghash.so'
|
bitmsglib = 'bitmsghash.so'
|
||||||
if "win32" == sys.platform:
|
if "win32" == sys.platform:
|
||||||
if ctypes.sizeof(ctypes.c_voidp) == 4:
|
if ctypes.sizeof(ctypes.c_voidp) == 4:
|
||||||
|
@ -128,13 +133,18 @@ def run(target, initialHash):
|
||||||
try:
|
try:
|
||||||
return _doGPUPoW(target, initialHash)
|
return _doGPUPoW(target, initialHash)
|
||||||
except:
|
except:
|
||||||
pass # fallback to normal PoW
|
pass # fallback
|
||||||
|
if bmpow:
|
||||||
|
try:
|
||||||
|
return _doCPoW(target, initialHash)
|
||||||
|
except:
|
||||||
|
pass # fallback
|
||||||
if frozen == "macosx_app" or not frozen:
|
if frozen == "macosx_app" or not frozen:
|
||||||
if bmpow:
|
# on my (Peter Surda) Windows 10, Windows Defender
|
||||||
try:
|
# does not like this and fights with PyBitmessage
|
||||||
return _doCPoW(target, initialHash)
|
# over CPU, resulting in very slow PoW
|
||||||
except:
|
try:
|
||||||
pass # fallback to normal PoW
|
return _doFastPoW(target, initialHash)
|
||||||
return _doFastPoW(target, initialHash)
|
except:
|
||||||
else:
|
pass #fallback
|
||||||
return _doSafePoW(target, initialHash)
|
return _doSafePoW(target, initialHash)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user