python3 porting 1: Essential files #2280
@ -1,8 +1,9 @@
|
|||||||
#!/usr/bin/env python2.7
|
#!/usr/bin/env python2.7
|
||||||
|
|
||||||
import collectd
|
|
||||||
import json
|
import json
|
||||||
import xmlrpclib
|
|
||||||
|
import collectd
|
||||||
|
from six.moves import xmlrpc_client as xmlrpclib
|
||||||
|
|
||||||
pybmurl = ""
|
pybmurl = ""
|
||||||
api = ""
|
api = ""
|
||||||
|
9
setup.py
9
setup.py
@ -4,14 +4,13 @@ import os
|
|||||||
import platform
|
import platform
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from importlib import import_module
|
from importlib import import_module
|
||||||
from setuptools import setup, Extension
|
|
||||||
|
from setuptools import Extension, setup
|
||||||
from setuptools.command.install import install
|
from setuptools.command.install import install
|
||||||
|
|
||||||
from src.version import softwareVersion
|
from src.version import softwareVersion
|
||||||
|
|
||||||
|
|
||||||
EXTRAS_REQUIRE = {
|
EXTRAS_REQUIRE = {
|
||||||
'docs': ['sphinx'],
|
'docs': ['sphinx'],
|
||||||
'gir': ['pygobject'],
|
'gir': ['pygobject'],
|
||||||
@ -92,7 +91,9 @@ if __name__ == "__main__":
|
|||||||
)
|
)
|
||||||
|
|
||||||
if os.environ.get('INSTALL_TESTS', False):
|
if os.environ.get('INSTALL_TESTS', False):
|
||||||
packages.extend(['pybitmessage.mockbm', 'pybitmessage.backend', 'pybitmessage.bitmessagekivy.tests'])
|
packages.extend(
|
||||||
|
['pybitmessage.mockbm', 'pybitmessage.backend', 'pybitmessage.bitmessagekivy.tests']
|
||||||
|
)
|
||||||
package_data[''].extend(['bitmessagekivy/tests/sampleData/*.dat'])
|
package_data[''].extend(['bitmessagekivy/tests/sampleData/*.dat'])
|
||||||
|
|
||||||
# this will silently accept alternative providers of msgpack
|
# this will silently accept alternative providers of msgpack
|
||||||
|
27
src/api.py
27
src/api.py
@ -70,29 +70,24 @@ from struct import pack, unpack
|
|||||||
|
|
||||||
import six
|
import six
|
||||||
from six.moves import configparser, http_client, xmlrpc_server
|
from six.moves import configparser, http_client, xmlrpc_server
|
||||||
|
from six.moves.reprlib import repr
|
||||||
|
|
||||||
import helper_inbox
|
import helper_inbox
|
||||||
import helper_sent
|
import helper_sent
|
||||||
import protocol
|
|
||||||
import proofofwork
|
import proofofwork
|
||||||
|
import protocol
|
||||||
import queues
|
import queues
|
||||||
import shared
|
import shared
|
||||||
|
|
||||||
import shutdown
|
import shutdown
|
||||||
import state
|
import state
|
||||||
from addresses import (
|
from addresses import (addBMIfNotPresent, decodeAddress, decodeVarint,
|
||||||
addBMIfNotPresent,
|
varintDecodeError)
|
||||||
decodeAddress,
|
|
||||||
decodeVarint,
|
|
||||||
varintDecodeError
|
|
||||||
)
|
|
||||||
from bmconfigparser import config
|
from bmconfigparser import config
|
||||||
from debug import logger
|
from debug import logger
|
||||||
from defaults import (
|
from defaults import (networkDefaultPayloadLengthExtraBytes,
|
||||||
networkDefaultProofOfWorkNonceTrialsPerByte,
|
networkDefaultProofOfWorkNonceTrialsPerByte)
|
||||||
networkDefaultPayloadLengthExtraBytes)
|
from helper_sql import (SqlBulkExecute, sql_ready, sqlExecute, sqlQuery,
|
||||||
from helper_sql import (
|
sqlStoredProcedure)
|
||||||
SqlBulkExecute, sqlExecute, sqlQuery, sqlStoredProcedure, sql_ready)
|
|
||||||
from highlevelcrypto import calculateInventoryHash
|
from highlevelcrypto import calculateInventoryHash
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -100,7 +95,7 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
connectionpool = None
|
connectionpool = None
|
||||||
|
|
||||||
from network import stats, StoppableThread, invQueue
|
from network import StoppableThread, invQueue, stats
|
||||||
from version import softwareVersion
|
from version import softwareVersion
|
||||||
|
|
||||||
try: # TODO: write tests for XML vulnerabilities
|
try: # TODO: write tests for XML vulnerabilities
|
||||||
@ -224,8 +219,8 @@ class singleAPI(StoppableThread):
|
|||||||
if config.safeGet(
|
if config.safeGet(
|
||||||
'bitmessagesettings', 'apivariant') == 'json':
|
'bitmessagesettings', 'apivariant') == 'json':
|
||||||
try:
|
try:
|
||||||
from jsonrpclib.SimpleJSONRPCServer import (
|
from jsonrpclib.SimpleJSONRPCServer import \
|
||||||
SimpleJSONRPCServer as RPCServerBase)
|
SimpleJSONRPCServer as RPCServerBase
|
||||||
except ImportError:
|
except ImportError:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
'jsonrpclib not available, failing back to XML-RPC')
|
'jsonrpclib not available, failing back to XML-RPC')
|
||||||
|
Reference in New Issue
Block a user