helper_sql #467

Merged
Atheros1 merged 19 commits from master into master 2013-09-03 05:20:20 +02:00
2 changed files with 13 additions and 3 deletions
Showing only changes of commit b83781cefb - Show all commits

View File

@ -4,7 +4,7 @@
import hashlib
from struct import unpack, pack
import sys
from shared import config
from shared import config, frozen
#import os
def _set_idle():
@ -71,7 +71,7 @@ def _doFastPoW(target, initialHash):
time.sleep(0.2)
def run(target, initialHash):
if 'linux' in sys.platform:
if frozen == "macosx_app" or not frozen:
return _doFastPoW(target, initialHash)
else:
return _doSafePoW(target, initialHash)

View File

@ -76,6 +76,11 @@ networkDefaultPayloadLengthExtraBytes = 14000 #To make sending short messages a
# namecoin integration to "namecoind".
namecoinDefaultRpcPort = "8336"
# When using py2exe or py2app, the variable frozen is added to the sys
# namespace. This can be used to setup a different code path for
# binary distributions vs source distributions.
frozen = getattr(sys,'frozen', None)
def isInSqlInventory(hash):
queryreturn = sqlQuery('''select hash from inventory where hash=?''', hash)
if queryreturn == []:
@ -118,7 +123,12 @@ def assembleVersionMessage(remoteHost, remotePort, myStreamNumber):
def lookupAppdataFolder():
APPNAME = "PyBitmessage"
if sys.platform == 'darwin':
from os import path, environ
if "BITMESSAGE_HOME" in environ:
dataFolder = environ["BITMESSAGE_HOME"]
if dataFolder[-1] not in [os.path.sep, os.path.altsep]:
dataFolder += os.path.sep
elif sys.platform == 'darwin':
if "HOME" in environ:
dataFolder = path.join(os.environ["HOME"], "Library/Application Support/", APPNAME) + '/'
else: