Initial commit for test cases python3 porting

This commit is contained in:
jai.s 2020-06-15 15:54:11 +05:30
parent bf1a57d9ca
commit 7773392847
No known key found for this signature in database
GPG Key ID: 360CFA25EFC67D12
334 changed files with 1476 additions and 708 deletions

View File

@ -1,6 +1,6 @@
language: python language: python
python: python:
- "2.7" - "3.7"
addons: addons:
apt: apt:
packages: packages:

View File

@ -36,6 +36,9 @@ COMPILING = {
"openSUSE": "gcc-c++ libopenssl-devel python-devel", "openSUSE": "gcc-c++ libopenssl-devel python-devel",
"optional": False, "optional": False,
} }
print('************************************')
print('inside the checkdeps')
print('************************************')
# OS-specific dependencies for optional components listed in EXTRAS_REQUIRE # OS-specific dependencies for optional components listed in EXTRAS_REQUIRE
EXTRAS_REQUIRE_DEPS = { EXTRAS_REQUIRE_DEPS = {

View File

@ -14,7 +14,6 @@ For help on fabric itself:
For more help on a particular command For more help on a particular command
""" """
from fabric.api import env from fabric.api import env
from fabfile.tasks import code_quality, build_docs, push_docs, clean, test from fabfile.tasks import code_quality, build_docs, push_docs, clean, test

View File

@ -46,13 +46,13 @@ def print_results(results, top, verbose, details):
"""Print an item with the appropriate verbosity / detail""" """Print an item with the appropriate verbosity / detail"""
if verbose and results: if verbose and results:
print ''.join( print( ''.join(
[ [
os.linesep, os.linesep,
'total pycodestyle flake8 pylint path_to_file', 'total pycodestyle flake8 pylint path_to_file',
os.linesep, os.linesep,
] ]
) ))
for item in sort_and_slice(results, top): for item in sort_and_slice(results, top):
@ -66,23 +66,23 @@ def print_results(results, top, verbose, details):
) )
else: else:
line = item['path_to_file'] line = item['path_to_file']
print line print (line)
if details: if details:
print "pycodestyle:" print ("pycodestyle:")
for detail in flatten(item['pycodestyle_violations']): for detail in flatten(item['pycodestyle_violations']):
print detail print (detail)
print print()
print "flake8:" print ("flake8:")
for detail in flatten(item['flake8_violations']): for detail in flatten(item['flake8_violations']):
print detail print (detail)
print print()
print "pylint:" print ("pylint:")
for detail in flatten(item['pylint_violations']): for detail in flatten(item['pylint_violations']):
print detail print (detail)
print print()
def sort_and_slice(results, top): def sort_and_slice(results, top):
@ -107,7 +107,7 @@ def generate_file_list(filename):
if filename: if filename:
filename = os.path.abspath(filename) filename = os.path.abspath(filename)
if not os.path.exists(filename): if not os.path.exists(filename):
print "Bad filename, specify a Python file" print("Bad filename, specify a Python file")
sys.exit(1) sys.exit(1)
else: else:
file_list = [filename] file_list = [filename]
@ -303,7 +303,7 @@ def push_docs(path=None):
) )
result = run('ln -sf {0} {1}'.format(WEB_ROOT, VERSION_ROOT)) result = run('ln -sf {0} {1}'.format(WEB_ROOT, VERSION_ROOT))
if result.return_code: if result.return_code:
print 'Linking the new release failed' print('Linking the new release failed')
# More assumptions # More assumptions
sudo('systemctl restart apache2') sudo('systemctl restart apache2')

BIN
images/kivy/paymode/111.webp Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

BIN
images/kivy/paymode/download.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -1,3 +1,11 @@
python_prctl python_prctl
psutil psutil
pycrypto pycrypto
qrcode
Fabric3
fabric-virtualenv
httplib2
urllib3
pythondialog
stem
Pillow

28
setup.py Normal file → Executable file
View File

@ -2,6 +2,7 @@
import os import os
import shutil import shutil
import sys
from setuptools import setup, Extension from setuptools import setup, Extension
from setuptools.command.install import install from setuptools.command.install import install
@ -17,9 +18,21 @@ EXTRAS_REQUIRE = {
'qrcode': ['qrcode'], 'qrcode': ['qrcode'],
'sound;platform_system=="Windows"': ['winsound'], 'sound;platform_system=="Windows"': ['winsound'],
'tor': ['stem'], 'tor': ['stem'],
'docs': ['sphinx', 'sphinxcontrib-apidoc', 'm2r'] 'docs': ['sphinx', 'sphinxcontrib-apidoc', 'm2r'],
'qrcode':['qrcode']
} }
if sys.version_info[0] == 2:
version_dependencies = {
'requirements_file' : 'requirements2.txt',
'pybitmessage_file' : 'src/pybitmessage2'
}
else:
version_dependencies = {
'requirements_file' : 'requirements.txt',
'pybitmessage_file' : 'src/pybitmessage'
}
class InstallCmd(install): class InstallCmd(install):
def run(self): def run(self):
@ -45,7 +58,7 @@ if __name__ == "__main__":
with open(os.path.join(here, 'README.md')) as f: with open(os.path.join(here, 'README.md')) as f:
README = f.read() README = f.read()
with open(os.path.join(here, 'requirements.txt'), 'r') as f: with open(os.path.join(here, version_dependencies['requirements_file']), 'r') as f:
requirements = list(f.readlines()) requirements = list(f.readlines())
bitmsghash = Extension( bitmsghash = Extension(
@ -57,8 +70,8 @@ if __name__ == "__main__":
installRequires = [] installRequires = []
packages = [ packages = [
'pybitmessage', 'pybitmessage',
'pybitmessage.bitmessageqt', # 'pybitmessage.bitmessageqt',
'pybitmessage.bitmessagecurses', # 'pybitmessage.bitmessagecurses',
'pybitmessage.fallback', 'pybitmessage.fallback',
'pybitmessage.messagetypes', 'pybitmessage.messagetypes',
'pybitmessage.network', 'pybitmessage.network',
@ -70,6 +83,7 @@ if __name__ == "__main__":
# this will silently accept alternative providers of msgpack # this will silently accept alternative providers of msgpack
# if they are already installed # if they are already installed
try: try:
import msgpack import msgpack
installRequires.append( installRequires.append(
@ -95,7 +109,7 @@ if __name__ == "__main__":
# TODO: add keywords # TODO: add keywords
#keywords='', #keywords='',
install_requires=installRequires, install_requires=installRequires,
tests_require=requirements, tests_require=requirements,
extras_require=EXTRAS_REQUIRE, extras_require=EXTRAS_REQUIRE,
classifiers=[ classifiers=[
"License :: OSI Approved :: MIT License" "License :: OSI Approved :: MIT License"
@ -108,7 +122,7 @@ if __name__ == "__main__":
package_dir={'pybitmessage': 'src'}, package_dir={'pybitmessage': 'src'},
packages=packages, packages=packages,
package_data={'': [ package_data={'': [
'bitmessageqt/*.ui', 'bitmsghash/*.cl', 'sslkeys/*.pem', 'sslkeys/*.pem',
'translations/*.ts', 'translations/*.qm', 'translations/*.ts', 'translations/*.qm',
'images/*.png', 'images/*.ico', 'images/*.icns' 'images/*.png', 'images/*.ico', 'images/*.icns'
]}, ]},
@ -148,7 +162,7 @@ if __name__ == "__main__":
# 'pybitmessage = pybitmessage.bitmessagemain:main' # 'pybitmessage = pybitmessage.bitmessagemain:main'
# ] # ]
}, },
scripts=['src/pybitmessage'], scripts=[version_dependencies['pybitmessage_file']],
cmdclass={'install': InstallCmd}, cmdclass={'install': InstallCmd},
command_options={ command_options={
'build_sphinx': { 'build_sphinx': {

0
src/__init__.py Normal file → Executable file
View File

6
src/addresses.py Normal file → Executable file
View File

@ -5,8 +5,10 @@ Operations with addresses
import hashlib import hashlib
from binascii import hexlify, unhexlify from binascii import hexlify, unhexlify
from struct import pack, unpack from struct import pack, unpack
try:
from debug import logger from debug import logger
except ModuleNotFoundError:
from .debug import logger
ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"

0
src/alice.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 669 B

After

Width:  |  Height:  |  Size: 669 B

89
src/api.py Normal file → Executable file
View File

@ -15,34 +15,59 @@ import socket
import subprocess import subprocess
import time import time
from binascii import hexlify, unhexlify from binascii import hexlify, unhexlify
from xmlrpc.server import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler, \
SimpleXMLRPCServer from xmlrpc.server import SimpleXMLRPCRequestHandler, SimpleXMLRPCServer
from struct import pack from struct import pack
import defaults
import helper_inbox try:
import helper_sent import defaults
import network.stats import helper_inbox
import proofofwork import helper_sent
import queues import network.stats
import shared import proofofwork
import shutdown import queues
import state import shared
import threads import shutdown
from addresses import ( import state
addBMIfNotPresent, from addresses import (
calculateInventoryHash, addBMIfNotPresent,
decodeAddress, calculateInventoryHash,
decodeVarint, decodeAddress,
varintDecodeError decodeVarint,
) varintDecodeError
from bmconfigparser import BMConfigParser )
from debug import logger from bmconfigparser import BMConfigParser
from helper_ackPayload import genAckPayload from debug import logger
from helper_sql import SqlBulkExecute, sqlExecute, sqlQuery, sqlStoredProcedure from helper_ackPayload import genAckPayload
from inventory import Inventory from helper_sql import SqlBulkExecute, sqlExecute, sqlQuery, sqlStoredProcedure
from network.threads import StoppableThread from inventory import Inventory
from version import softwareVersion from network.threads import StoppableThread
from version import softwareVersion
except:
from . import defaults
from . import helper_inbox
from . import helper_sent
from .network import stats
from . import proofofwork
from . import queues
from . import shared
from .import shutdown
from .import state
from .addresses import (
addBMIfNotPresent,
calculateInventoryHash,
decodeAddress,
decodeVarint,
varintDecodeError
)
from .bmconfigparser import BMConfigParser
from .debug import logger
from .helper_ackPayload import genAckPayload
from .helper_sql import SqlBulkExecute, sqlExecute, sqlQuery, sqlStoredProcedure
from .inventory import Inventory
from .network.threads import StoppableThread
from .version import softwareVersion
str_chan = '[chan]' str_chan = '[chan]'
@ -1227,7 +1252,8 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
initialHash = hashlib.sha512(encryptedPayload).digest() initialHash = hashlib.sha512(encryptedPayload).digest()
trialValue, nonce = proofofwork.run(target, initialHash) trialValue, nonce = proofofwork.run(target, initialHash)
with threads.printLock: with threads.printLock:
print('(For msg message via API) Found proof of work', trialValue, 'Nonce:', nonce) print('(For msg message via API) Found proof of work {}, Nonce: {})'.\
format(trialValue,nonce))
try: try:
print( print(
'POW took', int(time.time() - powStartTime), 'POW took', int(time.time() - powStartTime),
@ -1246,7 +1272,8 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
int(time.time()) + TTL, '' int(time.time()) + TTL, ''
) )
with threads.printLock: with threads.printLock:
print('Broadcasting inv for msg(API disseminatePreEncryptedMsg command):', hexlify(inventoryHash)) print('Broadcasting inv for msg(API disseminatePreEncryptedMsg command): {}'.\
format(hexlify(inventoryHash)))
queues.invQueue.put((toStreamNumber, inventoryHash)) queues.invQueue.put((toStreamNumber, inventoryHash))
def HandleTrashSentMessageByAckDAta(self, params): def HandleTrashSentMessageByAckDAta(self, params):
@ -1279,7 +1306,8 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
print('(For pubkey message via API) Doing proof of work...') print('(For pubkey message via API) Doing proof of work...')
initialHash = hashlib.sha512(payload).digest() initialHash = hashlib.sha512(payload).digest()
trialValue, nonce = proofofwork.run(target, initialHash) trialValue, nonce = proofofwork.run(target, initialHash)
print('(For pubkey message via API) Found proof of work', trialValue, 'Nonce:', nonce) print('(For pubkey message via API) Found proof of work {} ,Nonce: {}'.\
format(trialValue,nonce))
payload = pack('>Q', nonce) + payload payload = pack('>Q', nonce) + payload
pubkeyReadPosition = 8 # bypass the nonce pubkeyReadPosition = 8 # bypass the nonce
@ -1300,7 +1328,8 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
objectType, pubkeyStreamNumber, payload, int(time.time()) + TTL, '' objectType, pubkeyStreamNumber, payload, int(time.time()) + TTL, ''
) )
with threads.printLock: with threads.printLock:
print('broadcasting inv within API command disseminatePubkey with hash:', hexlify(inventoryHash)) print('broadcasting inv within API command disseminatePubkey with hash:{}'.\
format(hexlify(inventoryHash)))
queues.invQueue.put((pubkeyStreamNumber, inventoryHash)) queues.invQueue.put((pubkeyStreamNumber, inventoryHash))
def HandleGetMessageDataByDestinationHash(self, params): def HandleGetMessageDataByDestinationHash(self, params):

8
src/bitmessagecli.py Normal file → Executable file
View File

@ -21,10 +21,12 @@ import os
import socket import socket
import sys import sys
import time import time
import xmlrpclib import xmlrpc.client as xmlrpclib
from bmconfigparser import BMConfigParser
try:
from bmconfigparser import BMConfigParser
except:
from .bmconfigparser import BMConfigParser
api = '' api = ''
keysName = 'keys.dat' keysName = 'keys.dat'

40
src/bitmessagecurses/__init__.py Normal file → Executable file
View File

@ -10,27 +10,41 @@ Bitmessage commandline interface
# * python2-pythondialog # * python2-pythondialog
# * dialog # * dialog
import ConfigParser import configparser as ConfigParser
import curses import curses
import os import os
import sys import sys
import time import time
from textwrap import fill from textwrap import fill
from threading import Timer from threading import Timer
from dialog import Dialog from dialog import Dialog
import l10n
import network.stats
import queues
import shared
import shutdown
import state
from addresses import addBMIfNotPresent, decodeAddress try:
from bmconfigparser import BMConfigParser from dialog import Dialog
from helper_ackPayload import genAckPayload import l10n
from helper_sql import sqlExecute, sqlQuery import network.stats
from inventory import Inventory import queues
import shared
import shutdown
from addresses import addBMIfNotPresent, decodeAddress
from bmconfigparser import BMConfigParser
from helper_ackPayload import genAckPayload
from helper_sql import sqlExecute, sqlQuery
from inventory import Inventory
except ModuleNotFoundError:
from .. import l10n
from ..network import stats
from .. import queues
from .. import shared
from .. import shutdown
from ..addresses import addBMIfNotPresent, decodeAddress
from ..bmconfigparser import BMConfigParser
from ..helper_ackPayload import genAckPayload
from ..helper_sql import sqlExecute, sqlQuery
from ..inventory import Inventory
# pylint: disable=global-statement # pylint: disable=global-statement

0
src/bitmessagekivy/__init__.py Normal file → Executable file
View File

0
src/bitmessagekivy/identiconGeneration.py Normal file → Executable file
View File

6
src/bitmessagekivy/kivy_helper_search.py Normal file → Executable file
View File

@ -1,8 +1,10 @@
""" """
Sql queries for bitmessagekivy Sql queries for bitmessagekivy
""" """
from helper_sql import sqlQuery try:
from helper_sql import sqlQuery
except ModuleNotFoundError:
from ..helper_sql import sqlQuery
def search_sql( def search_sql(
xAddress="toaddress", account=None, folder="inbox", where=None, xAddress="toaddress", account=None, folder="inbox", where=None,

0
src/bitmessagekivy/kv/addressbook.kv Normal file → Executable file
View File

0
src/bitmessagekivy/kv/allmails.kv Normal file → Executable file
View File

0
src/bitmessagekivy/kv/chat_list.kv Normal file → Executable file
View File

0
src/bitmessagekivy/kv/chat_room.kv Normal file → Executable file
View File

0
src/bitmessagekivy/kv/common_widgets.kv Normal file → Executable file
View File

0
src/bitmessagekivy/kv/composer.kv Normal file → Executable file
View File

0
src/bitmessagekivy/kv/credits.kv Normal file → Executable file
View File

0
src/bitmessagekivy/kv/draft.kv Normal file → Executable file
View File

0
src/bitmessagekivy/kv/inbox.kv Normal file → Executable file
View File

0
src/bitmessagekivy/kv/login.kv Normal file → Executable file
View File

0
src/bitmessagekivy/kv/maildetail.kv Normal file → Executable file
View File

0
src/bitmessagekivy/kv/myaddress.kv Normal file → Executable file
View File

0
src/bitmessagekivy/kv/network.kv Normal file → Executable file
View File

0
src/bitmessagekivy/kv/payment.kv Normal file → Executable file
View File

0
src/bitmessagekivy/kv/popup.kv Normal file → Executable file
View File

0
src/bitmessagekivy/kv/sent.kv Normal file → Executable file
View File

0
src/bitmessagekivy/kv/settings.kv Normal file → Executable file
View File

0
src/bitmessagekivy/kv/trash.kv Normal file → Executable file
View File

0
src/bitmessagekivy/main.kv Normal file → Executable file
View File

32
src/bitmessagekivy/mpybit.py Normal file → Executable file
View File

@ -13,12 +13,19 @@ Bitmessage android(mobile) interface
from bitmessagekivy.get_platform import platform from bitmessagekivy.get_platform import platform
import os import os
import time import time
from bitmessagekivy import identiconGeneration
from bitmessagekivy import kivy_helper_search
from bitmessagekivy.uikivysignaler import UIkivySignaler
from bmconfigparser import BMConfigParser
from functools import partial from functools import partial
from helper_sql import sqlExecute, sqlQuery try:
from bitmessagekivy import identiconGeneration
from bitmessagekivy import kivy_helper_search
from bitmessagekivy.uikivysignaler import UIkivySignaler
from bmconfigparser import BMConfigParser
from helper_sql import sqlExecute, sqlQuery
except ModuleNotFoundError:
from ..bitmessagekivy import identiconGeneration
from ..bitmessagekivy import kivy_helper_search
from ..bitmessagekivy.uikivysignaler import UIkivySignaler
from ..bmconfigparser import BMConfigParser
from ..helper_sql import sqlExecute, sqlQuery
from kivymd.app import MDApp from kivymd.app import MDApp
from kivy.clock import Clock from kivy.clock import Clock
from kivy.core.clipboard import Clipboard from kivy.core.clipboard import Clipboard
@ -68,11 +75,18 @@ from kivymd.uix.selectioncontrol import MDCheckbox, MDSwitch
from kivymd.uix.chip import MDChip from kivymd.uix.chip import MDChip
from kivy.uix.screenmanager import RiseInTransition, SlideTransition, FallOutTransition from kivy.uix.screenmanager import RiseInTransition, SlideTransition, FallOutTransition
import queues try:
from semaphores import kivyuisignaler import queues
from semaphores import kivyuisignaler
import state
from addresses import decodeAddress
except ModuleNotFoundError:
from .. import queues
from ..semaphores import kivyuisignaler
from .. import state
from ..addresses import decodeAddress
import state
from addresses import decodeAddress
from datetime import datetime from datetime import datetime
from kivymd.uix.behaviors.elevation import RectangularElevationBehavior from kivymd.uix.behaviors.elevation import RectangularElevationBehavior
from kivymd.uix.bottomsheet import MDCustomBottomSheet from kivymd.uix.bottomsheet import MDCustomBottomSheet

12
src/bitmessagekivy/uikivysignaler.py Normal file → Executable file
View File

@ -3,10 +3,14 @@ Ui Singnaler for kivy interface
""" """
from threading import Thread from threading import Thread
import queues try:
import state import queues
from semaphores import kivyuisignaler import state
from semaphores import kivyuisignaler
except ModuleNotFoundError:
from .. import queues
from .. import state
from ..semaphores import kivyuisignaler
class UIkivySignaler(Thread): class UIkivySignaler(Thread):
"""Kivy ui signaler""" """Kivy ui signaler"""

View File

@ -1,4 +1,4 @@
#!/usr/bin/python2.7 #!/usr/local/bin/python3.7
""" """
The PyBitmessage startup script The PyBitmessage startup script
""" """
@ -22,29 +22,57 @@ import time
import traceback import traceback
from struct import pack from struct import pack
import defaults try:
import depends import defaults
import shared import depends
import shutdown import shared
import state import shutdown
import state
from bmconfigparser import BMConfigParser
# this should go before any threads
from debug import logger
from helper_startup import (
adjustHalfOpenConnectionsLimit,
start_proxyconfig
)
from inventory import Inventory
from knownnodes import readKnownNodes
# Network objects and threads
from network import (
BMConnectionPool, Dandelion, AddrThread, AnnounceThread, BMNetworkThread,
InvThread, ReceiveQueueThread, DownloadThread, UploadThread
)
from singleinstance import singleinstance
# Synchronous threads
from threads import (set_thread_name, printLock,
addressGenerator, objectProcessor, singleCleaner, singleWorker, sqlThread)
from bmconfigparser import BMConfigParser except ModuleNotFoundError:
# this should go before any threads from pybitmessage import defaults
from debug import logger from pybitmessage import depends
from helper_startup import ( from pybitmessage import shared
adjustHalfOpenConnectionsLimit, start_proxyconfig) from pybitmessage import shutdown
from inventory import Inventory from pybitmessage import state
from knownnodes import readKnownNodes
# Network objects and threads from pybitmessage.bmconfigparser import BMConfigParser
from network import ( # this should go before any threads
BMConnectionPool, Dandelion, AddrThread, AnnounceThread, BMNetworkThread, from pybitmessage.debug import logger
InvThread, ReceiveQueueThread, DownloadThread, UploadThread from pybitmessage.helper_startup import (
) adjustHalfOpenConnectionsLimit,
from singleinstance import singleinstance start_proxyconfig
# Synchronous threads )
from threads import ( from pybitmessage.inventory import Inventory
set_thread_name, printLock, from pybitmessage.knownnodes import readKnownNodes
addressGenerator, objectProcessor, singleCleaner, singleWorker, sqlThread) # Network objects and threads
from pybitmessage.network import (
BMConnectionPool, Dandelion, AddrThread, AnnounceThread, BMNetworkThread,
InvThread, ReceiveQueueThread, DownloadThread, UploadThread
)
from pybitmessage.singleinstance import singleinstance
# Synchronous threads
from pybitmessage.threads import (set_thread_name, printLock,
addressGenerator, objectProcessor, singleCleaner,
singleWorker, sqlThread)
app_dir = os.path.dirname(os.path.abspath(__file__)) app_dir = os.path.dirname(os.path.abspath(__file__))
os.chdir(app_dir) os.chdir(app_dir)
@ -353,8 +381,9 @@ class Main(object):
state.kivyapp = NavigateApp() state.kivyapp = NavigateApp()
state.kivyapp.run() state.kivyapp.run()
else: else:
import bitmessageqt pass
bitmessageqt.run() # import bitmessageqt
# bitmessageqt.run()
else: else:
config.remove_option('bitmessagesettings', 'dontconnect') config.remove_option('bitmessagesettings', 'dontconnect')

104
src/bitmessageqt/__init__.py Normal file → Executable file
View File

@ -17,41 +17,75 @@ from sqlite3 import register_adapter
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from PyQt4.QtNetwork import QLocalSocket, QLocalServer from PyQt4.QtNetwork import QLocalSocket, QLocalServer
try:
import shared import shared
import state import state
from debug import logger from debug import logger
from tr import _translate from tr import _translate
from addresses import decodeAddress, addBMIfNotPresent from addresses import decodeAddress, addBMIfNotPresent
from bitmessageui import Ui_MainWindow from bitmessageui import Ui_MainWindow
from bmconfigparser import BMConfigParser from bmconfigparser import BMConfigParser
import namecoin import namecoin
from messageview import MessageView from messageview import MessageView
from migrationwizard import Ui_MigrationWizard from migrationwizard import Ui_MigrationWizard
from foldertree import ( from foldertree import (
AccountMixin, Ui_FolderWidget, Ui_AddressWidget, Ui_SubscriptionWidget, AccountMixin, Ui_FolderWidget, Ui_AddressWidget, Ui_SubscriptionWidget,
MessageList_AddressWidget, MessageList_SubjectWidget, MessageList_AddressWidget, MessageList_SubjectWidget,
Ui_AddressBookWidgetItemLabel, Ui_AddressBookWidgetItemAddress, Ui_AddressBookWidgetItemLabel, Ui_AddressBookWidgetItemAddress,
MessageList_TimeWidget) MessageList_TimeWidget)
import settingsmixin import settingsmixin
import support import support
from helper_ackPayload import genAckPayload from helper_ackPayload import genAckPayload
from helper_sql import sqlQuery, sqlExecute, sqlExecuteChunked, sqlStoredProcedure from helper_sql import sqlQuery, sqlExecute, sqlExecuteChunked, sqlStoredProcedure
import helper_search import helper_search
import l10n import l10n
from utils import str_broadcast_subscribers, avatarize from utils import str_broadcast_subscribers, avatarize
from account import ( from account import (
getSortedAccounts, getSortedSubscriptions, accountClass, BMAccount, getSortedAccounts, getSortedSubscriptions, accountClass, BMAccount,
GatewayAccount, MailchuckAccount, AccountColor) GatewayAccount, MailchuckAccount, AccountColor)
import dialogs import dialogs
from network.stats import pendingDownload, pendingUpload from network.stats import pendingDownload, pendingUpload
from uisignaler import UISignaler from uisignaler import UISignaler
import paths import paths
from proofofwork import getPowType from proofofwork import getPowType
import queues import queues
import shutdown import shutdown
from statusbar import BMStatusBar from statusbar import BMStatusBar
import sound import sound
except Exception:
from ..debug import logger
from ..tr import _translate
from ..addresses import decodeAddress, addBMIfNotPresent
from .. import shared
from .bitmessageui import Ui_MainWindow
from ..bmconfigparser import BMConfigParser
from .. import namecoin
from .messageview import MessageView
from .migrationwizard import Ui_MigrationWizard
from .foldertree import (
AccountMixin, Ui_FolderWidget, Ui_AddressWidget, Ui_SubscriptionWidget,
MessageList_AddressWidget, MessageList_SubjectWidget,
Ui_AddressBookWidgetItemLabel, Ui_AddressBookWidgetItemAddress)
from . import settingsmixin
from . import support
from ..helper_ackPayload import genAckPayload
from ..helper_sql import sqlQuery, sqlExecute, sqlExecuteChunked, sqlStoredProcedure
from .. import helper_search
from .. import l10n
from .utils import str_broadcast_subscribers, avatarize
from .account import (
getSortedAccounts, getSortedSubscriptions, accountClass, BMAccount,
GatewayAccount, MailchuckAccount, AccountColor)
from . import dialogs
from ..network.stats import pendingDownload, pendingUpload
from .uisignaler import UISignaler
from .. import paths
from ..proofofwork import getPowType
from .. import queues
from .. import shutdown
from .. import state
from .statusbar import BMStatusBar
from . import sound
# This is needed for tray icon # This is needed for tray icon
import bitmessage_icons_rc # noqa:F401 pylint: disable=unused-import import bitmessage_icons_rc # noqa:F401 pylint: disable=unused-import

0
src/bitmessageqt/about.ui Normal file → Executable file
View File

0
src/bitmessageqt/account.py Normal file → Executable file
View File

0
src/bitmessageqt/addaddressdialog.ui Normal file → Executable file
View File

0
src/bitmessageqt/addpeer.ui Normal file → Executable file
View File

0
src/bitmessageqt/address_dialogs.py Normal file → Executable file
View File

0
src/bitmessageqt/addressvalidator.py Normal file → Executable file
View File

0
src/bitmessageqt/bitmessage_icons.qrc Normal file → Executable file
View File

0
src/bitmessageqt/bitmessage_icons_rc.py Normal file → Executable file
View File

0
src/bitmessageqt/bitmessageui.py Normal file → Executable file
View File

0
src/bitmessageqt/bitmessageui.ui Normal file → Executable file
View File

0
src/bitmessageqt/blacklist.py Normal file → Executable file
View File

0
src/bitmessageqt/blacklist.ui Normal file → Executable file
View File

0
src/bitmessageqt/connect.ui Normal file → Executable file
View File

0
src/bitmessageqt/dialogs.py Normal file → Executable file
View File

0
src/bitmessageqt/emailgateway.ui Normal file → Executable file
View File

0
src/bitmessageqt/foldertree.py Normal file → Executable file
View File

0
src/bitmessageqt/help.ui Normal file → Executable file
View File

0
src/bitmessageqt/iconglossary.ui Normal file → Executable file
View File

0
src/bitmessageqt/languagebox.py Normal file → Executable file
View File

0
src/bitmessageqt/messagecompose.py Normal file → Executable file
View File

0
src/bitmessageqt/messageview.py Normal file → Executable file
View File

0
src/bitmessageqt/migrationwizard.py Normal file → Executable file
View File

0
src/bitmessageqt/networkstatus.py Normal file → Executable file
View File

0
src/bitmessageqt/networkstatus.ui Normal file → Executable file
View File

0
src/bitmessageqt/newaddressdialog.ui Normal file → Executable file
View File

0
src/bitmessageqt/newaddresswizard.py Normal file → Executable file
View File

0
src/bitmessageqt/newchandialog.py Normal file → Executable file
View File

0
src/bitmessageqt/newchandialog.ui Normal file → Executable file
View File

0
src/bitmessageqt/newsubscriptiondialog.ui Normal file → Executable file
View File

0
src/bitmessageqt/regenerateaddresses.ui Normal file → Executable file
View File

0
src/bitmessageqt/retranslateui.py Normal file → Executable file
View File

0
src/bitmessageqt/safehtmlparser.py Normal file → Executable file
View File

34
src/bitmessageqt/settings.py Normal file → Executable file
View File

@ -23,6 +23,40 @@ from helper_startup import start_proxyconfig
from network.asyncore_pollchoose import set_rates from network.asyncore_pollchoose import set_rates
from tr import _translate from tr import _translate
try:
import debug
import defaults
import knownnodes
import namecoin
import openclpow
import paths
import queues
import shared
import state
import tempfile
import widgets
from bmconfigparser import BMConfigParser
from helper_sql import sqlExecute, sqlStoredProcedure
from helper_startup import start_proxyconfig
from network.asyncore_pollchoose import set_rates
from tr import _translate
except:
from .. import debug
from .. import defaults
from .. import knownnodes
from .. import namecoin
from .. import openclpow
from .. import paths
from .. import queues
from .. import shared
from .. import state
# from .. import tempfile
# import widgets
from ..bmconfigparser import BMConfigParser
from ..helper_sql import sqlExecute, sqlStoredProcedure
from ..helper_startup import start_proxyconfig
from ..network.asyncore_pollchoose import set_rates
from ..tr import _translate
def getSOCKSProxyType(config): def getSOCKSProxyType(config):
"""Get user socksproxytype setting from *config*""" """Get user socksproxytype setting from *config*"""

0
src/bitmessageqt/settings.ui Normal file → Executable file
View File

0
src/bitmessageqt/settingsmixin.py Normal file → Executable file
View File

0
src/bitmessageqt/sound.py Normal file → Executable file
View File

0
src/bitmessageqt/specialaddressbehavior.ui Normal file → Executable file
View File

0
src/bitmessageqt/statusbar.py Normal file → Executable file
View File

50
src/bitmessageqt/support.py Normal file → Executable file
View File

@ -8,23 +8,41 @@ import time
from PyQt4 import QtCore from PyQt4 import QtCore
import account try:
import defaults import account
import network.stats from bmconfigparser import BMConfigParser
import paths from debug import logger
import proofofwork import defaults
import queues from foldertree import AccountMixin
import state from helper_sql import *
from bmconfigparser import BMConfigParser from l10n import getTranslationLanguage
from foldertree import AccountMixin from openclpow import openclAvailable, openclEnabled
from helper_sql import sqlExecute, sqlQuery import paths
from l10n import getTranslationLanguage import proofofwork
from openclpow import openclEnabled from pyelliptic.openssl import OpenSSL
from pyelliptic.openssl import OpenSSL from settings import getSOCKSProxyType
from settings import getSOCKSProxyType import queues
from version import softwareVersion import network.stats
from tr import _translate import state
from version import softwareVersion
except:
from .. import account
from ..bmconfigparser import BMConfigParser
from ..debug import logger
from .. import defaults
# from ..foldertree import AccountMixin
from ..helper_sql import *
from ..l10n import getTranslationLanguage
from ..openclpow import openclAvailable, openclEnabled
from .. import paths
from .. import proofofwork
from ..pyelliptic.openssl import OpenSSL
from .settings import getSOCKSProxyType
from .. import queues
from ..network import stats
from .. import state
from ..version import softwareVersion
# this is BM support address going to Peter Surda # this is BM support address going to Peter Surda
OLD_SUPPORT_ADDRESS = 'BM-2cTkCtMYkrSPwFTpgcBrMrf5d8oZwvMZWK' OLD_SUPPORT_ADDRESS = 'BM-2cTkCtMYkrSPwFTpgcBrMrf5d8oZwvMZWK'

0
src/bitmessageqt/uisignaler.py Normal file → Executable file
View File

0
src/bitmessageqt/utils.py Normal file → Executable file
View File

0
src/bitmessageqt/wanlan.ui Normal file → Executable file
View File

0
src/bitmessageqt/widgets.py Normal file → Executable file
View File

0
src/bitmsghash/Makefile Normal file → Executable file
View File

0
src/bitmsghash/Makefile.bsd Normal file → Executable file
View File

0
src/bitmsghash/Makefile.msvc Normal file → Executable file
View File

0
src/bitmsghash/bitmsghash.cl Normal file → Executable file
View File

0
src/bitmsghash/bitmsghash.cpp Normal file → Executable file
View File

9
src/bmconfigparser.py Normal file → Executable file
View File

@ -7,8 +7,13 @@ import os
import shutil import shutil
from datetime import datetime from datetime import datetime
import state try:
from singleton import Singleton import state
from singleton import Singleton
except ModuleNotFoundError:
from . import state
from .singleton import Singleton
BMConfigDefaults = { BMConfigDefaults = {
"bitmessagesettings": { "bitmessagesettings": {

0
src/bob.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 640 B

After

Width:  |  Height:  |  Size: 640 B

0
src/build_osx.py Normal file → Executable file
View File

0
src/buildozer.spec Normal file → Executable file
View File

40
src/class_addressGenerator.py Normal file → Executable file
View File

@ -4,20 +4,32 @@ A thread for creating addresses
import hashlib import hashlib
import time import time
from binascii import hexlify from binascii import hexlify
try:
import defaults import defaults
import highlevelcrypto import highlevelcrypto
import queues import queues
import shared import shared
import state import state
import tr import tr
from addresses import decodeAddress, encodeAddress, encodeVarint from addresses import decodeAddress, encodeAddress, encodeVarint
from bmconfigparser import BMConfigParser from bmconfigparser import BMConfigParser
from fallback import RIPEMD160Hash from fallback import RIPEMD160Hash
from pyelliptic import arithmetic from pyelliptic import arithmetic
from pyelliptic.openssl import OpenSSL from pyelliptic.openssl import OpenSSL
from network.threads import StoppableThread from network.threads import StoppableThread
except ModuleNotFoundError:
from . import defaults
from .import highlevelcrypto
from . import queues
from . import shared
from . import state
from . import tr
from .addresses import decodeAddress, encodeAddress, encodeVarint
from .bmconfigparser import BMConfigParser
from .fallback import RIPEMD160Hash
from .pyelliptic import arithmetic
from .pyelliptic.openssl import OpenSSL
from .network.threads import StoppableThread
class addressGenerator(StoppableThread): class addressGenerator(StoppableThread):
"""A thread for creating addresses""" """A thread for creating addresses"""

68
src/class_objectProcessor.py Normal file → Executable file
View File

@ -12,28 +12,52 @@ import time
from binascii import hexlify from binascii import hexlify
from subprocess import call # nosec from subprocess import call # nosec
import helper_bitcoin try:
import helper_inbox import helper_bitcoin
import helper_msgcoding import helper_inbox
import helper_sent import helper_msgcoding
import highlevelcrypto import helper_sent
import knownnodes import highlevelcrypto
import l10n import knownnodes
import protocol import l10n
import queues import protocol
import shared import queues
import state import shared
import tr import state
from addresses import ( import tr
calculateInventoryHash, decodeAddress, decodeVarint, from addresses import (
encodeAddress, encodeVarint, varintDecodeError calculateInventoryHash, decodeAddress, decodeVarint,
) encodeAddress, encodeVarint, varintDecodeError
from bmconfigparser import BMConfigParser )
from fallback import RIPEMD160Hash from bmconfigparser import BMConfigParser
from helper_ackPayload import genAckPayload from fallback import RIPEMD160Hash
from helper_sql import SqlBulkExecute, sqlExecute, sqlQuery from helper_ackPayload import genAckPayload
from network import bmproto from helper_sql import SqlBulkExecute, sqlExecute, sqlQuery
from network.node import Peer from network import bmproto
from network.node import Peer
except ModuleNotFoundError:
from . import helper_bitcoin
from . import helper_inbox
from . import helper_msgcoding
from . import helper_sent
from . import highlevelcrypto
from . import knownnodes
from . import l10n
from . import protocol
from . import queues
from . import shared
from . import state
from . import tr
from .addresses import (
calculateInventoryHash, decodeAddress, decodeVarint,
encodeAddress, encodeVarint, varintDecodeError
)
from .bmconfigparser import BMConfigParser
from .fallback import RIPEMD160Hash
from .helper_ackPayload import genAckPayload
from .helper_sql import SqlBulkExecute, sqlExecute, sqlQuery
from .network import bmproto
from .network.node import Peer
# pylint: disable=too-many-locals, too-many-return-statements, too-many-branches, too-many-statements # pylint: disable=too-many-locals, too-many-return-statements, too-many-branches, too-many-statements
logger = logging.getLogger('default') logger = logging.getLogger('default')

41
src/class_singleCleaner.py Normal file → Executable file
View File

@ -23,18 +23,30 @@ import gc
import os import os
from datetime import datetime, timedelta from datetime import datetime, timedelta
import time import time
import shared
import knownnodes try:
import queues import shared
import state import knownnodes
import tr import queues
from bmconfigparser import BMConfigParser import state
from helper_sql import sqlExecute, sqlQuery import tr
from inventory import Inventory from bmconfigparser import BMConfigParser
from network.connectionpool import BMConnectionPool from helper_sql import sqlExecute, sqlQuery
from network.threads import StoppableThread from inventory import Inventory
from network.connectionpool import BMConnectionPool
from network.threads import StoppableThread
except ModuleNotFoundError:
from . import shared
from . import knownnodes
from . import queues
from . import state
from . import tr
from .bmconfigparser import BMConfigParser
from .helper_sql import sqlExecute, sqlQuery
from .inventory import Inventory
from .network.connectionpool import BMConnectionPool
from .network.threads import StoppableThread
#: Equals 4 weeks. You could make this longer if you want #: Equals 4 weeks. You could make this longer if you want
#: but making it shorter would not be advisable because #: but making it shorter would not be advisable because
@ -82,9 +94,12 @@ class singleCleaner(StoppableThread):
# If we are running as a daemon then we are going to fill up the UI # If we are running as a daemon then we are going to fill up the UI
# queue which will never be handled by a UI. We should clear it to # queue which will never be handled by a UI. We should clear it to
# save memory. # save memory.
# FIXME redundant? # ..FIXME redundant?
if state.thisapp.daemon or not state.enableGUI: try:
queues.UISignalQueue.queue.clear() if shared.thisapp.daemon or not state.enableGUI:
queues.UISignalQueue.queue.clear()
except:
pass
if timeWeLastClearedInventoryAndPubkeysTables < \ if timeWeLastClearedInventoryAndPubkeysTables < \
int(time.time()) - 7380: int(time.time()) - 7380:
timeWeLastClearedInventoryAndPubkeysTables = int(time.time()) timeWeLastClearedInventoryAndPubkeysTables = int(time.time())

59
src/class_singleWorker.py Normal file → Executable file
View File

@ -13,27 +13,48 @@ from binascii import hexlify, unhexlify
from struct import pack from struct import pack
from subprocess import call # nosec from subprocess import call # nosec
import defaults try:
import helper_inbox import defaults
import helper_msgcoding import helper_inbox
import helper_random import helper_msgcoding
import highlevelcrypto import helper_random
import l10n import highlevelcrypto
import proofofwork import l10n
import protocol import proofofwork
import queues import protocol
import shared import queues
import state import shared
import tr import state
from addresses import ( import tr
calculateInventoryHash, decodeAddress, decodeVarint, encodeVarint from addresses import (
) calculateInventoryHash, decodeAddress, decodeVarint, encodeVarint
)
from bmconfigparser import BMConfigParser from bmconfigparser import BMConfigParser
from helper_sql import sqlExecute, sqlQuery from helper_sql import sqlExecute, sqlQuery
from inventory import Inventory from inventory import Inventory
from network.threads import StoppableThread from network.threads import StoppableThread
except ModuleNotFoundError:
from . import defaults
from . import helper_inbox
from . import helper_msgcoding
from . import helper_random
from . import highlevelcrypto
from . import l10n
from . import proofofwork
from . import protocol
from . import queues
from . import shared
from . import state
from . import tr
from .addresses import (
calculateInventoryHash, decodeAddress, decodeVarint, encodeVarint
)
from .bmconfigparser import BMConfigParser
from .helper_sql import sqlExecute, sqlQuery
from .inventory import Inventory
from .network.threads import StoppableThread
# This thread, of which there is only one, does the heavy lifting: # This thread, of which there is only one, does the heavy lifting:
# calculating POWs. # calculating POWs.

18
src/class_smtpDeliver.py Normal file → Executable file
View File

@ -3,14 +3,22 @@ SMTP client thread for delivering emails
""" """
# pylint: disable=unused-variable # pylint: disable=unused-variable
import smtplib import smtplib
import urlparse import urllib.parse as urlparse
from email.header import Header from email.header import Header
from email.mime.text import MIMEText from email.mime.text import MIMEText
import queues try:
import state import queues
from bmconfigparser import BMConfigParser import state
from network.threads import StoppableThread from bmconfigparser import BMConfigParser
from network.threads import StoppableThread
except ModuleNotFoundError:
from . import queues
from . import state
from .bmconfigparser import BMConfigParser
from .network.threads import StoppableThread
SMTPDOMAIN = "bmaddr.lan" SMTPDOMAIN = "bmaddr.lan"

24
src/class_smtpServer.py Normal file → Executable file
View File

@ -12,14 +12,22 @@ import threading
import time import time
from email.header import decode_header from email.header import decode_header
from email.parser import Parser from email.parser import Parser
try:
import queues import queues
from addresses import decodeAddress from addresses import decodeAddress
from bmconfigparser import BMConfigParser from bmconfigparser import BMConfigParser
from helper_ackPayload import genAckPayload from helper_ackPayload import genAckPayload
from helper_sql import sqlExecute from helper_sql import sqlExecute
from network.threads import StoppableThread from network.threads import StoppableThread
from version import softwareVersion from version import softwareVersion
except ModuleNotFoundError:
from . import queues
from .addresses import decodeAddress
from .bmconfigparser import BMConfigParser
from .helper_ackPayload import genAckPayload
from .helper_sql import sqlExecute
from .network.threads import StoppableThread
from .version import softwareVersion
SMTPDOMAIN = "bmaddr.lan" SMTPDOMAIN = "bmaddr.lan"
LISTENPORT = 8425 LISTENPORT = 8425

Some files were not shown because too many files have changed in this diff Show More