forked from LBRYCommunity/lbry-sdk
Merge branch 'fix-windows-signing'
* fix-windows-signing: pylint type checking pointless strings pylint try decrypting cert re-enable secure vars
This commit is contained in:
commit
06fab24437
11 changed files with 40 additions and 42 deletions
|
@ -3,12 +3,12 @@ version: 1.0.{build}
|
||||||
environment:
|
environment:
|
||||||
GH_TOKEN:
|
GH_TOKEN:
|
||||||
secure: LiI5jyuHUw6XbH4kC3gP1HX4P/v4rwD/gCNtaFhQu2AvJz1/1wALkp5ECnIxRySN
|
secure: LiI5jyuHUw6XbH4kC3gP1HX4P/v4rwD/gCNtaFhQu2AvJz1/1wALkp5ECnIxRySN
|
||||||
# key_pass:
|
key_pass:
|
||||||
# secure: u6DydPcdrUJlxGL9uc7yQRYG8+5rY6aAEE9nfCSzFyNzZlX9NniOp8Uh5ZKQqX7bGEngLI6ipbLfiJvn0XFnhbn2iTkOuMqOXVJVOehvwlQ=
|
secure: u6DydPcdrUJlxGL9uc7yQRYG8+5rY6aAEE9nfCSzFyNzZlX9NniOp8Uh5ZKQqX7bGEngLI6ipbLfiJvn0XFnhbn2iTkOuMqOXVJVOehvwlQ=
|
||||||
# pfx_key:
|
pfx_key:
|
||||||
# secure: 1mwqyRy7hDqDjDK+TIAoaXyXzpNgwruFNA6TPkinUcVM7A+NLD33RQLnfnwVy+R5ovD2pUfhQ6+N0Fqebv6tZh436LIEsock+6IOdpgFwrg=
|
secure: 1mwqyRy7hDqDjDK+TIAoaXyXzpNgwruFNA6TPkinUcVM7A+NLD33RQLnfnwVy+R5ovD2pUfhQ6+N0Fqebv6tZh436LIEsock+6IOdpgFwrg=
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
#notifications:
|
#notifications:
|
||||||
# - provider: Slack
|
# - provider: Slack
|
||||||
# incoming_webhook:
|
# incoming_webhook:
|
||||||
|
|
|
@ -92,14 +92,12 @@ disable=
|
||||||
no-member,
|
no-member,
|
||||||
no-self-use,
|
no-self-use,
|
||||||
not-context-manager,
|
not-context-manager,
|
||||||
pointless-string-statement,
|
|
||||||
protected-access,
|
protected-access,
|
||||||
redefined-builtin,
|
redefined-builtin,
|
||||||
redefined-outer-name,
|
redefined-outer-name,
|
||||||
redefined-variable-type,
|
redefined-variable-type,
|
||||||
relative-import,
|
relative-import,
|
||||||
signature-differs,
|
signature-differs,
|
||||||
singleton-comparison,
|
|
||||||
super-init-not-called,
|
super-init-not-called,
|
||||||
too-few-public-methods,
|
too-few-public-methods,
|
||||||
too-many-arguments,
|
too-many-arguments,
|
||||||
|
@ -114,7 +112,6 @@ disable=
|
||||||
trailing-newlines,
|
trailing-newlines,
|
||||||
undefined-loop-variable,
|
undefined-loop-variable,
|
||||||
ungrouped-imports,
|
ungrouped-imports,
|
||||||
unidiomatic-typecheck,
|
|
||||||
unnecessary-lambda,
|
unnecessary-lambda,
|
||||||
unused-argument,
|
unused-argument,
|
||||||
unused-variable,
|
unused-variable,
|
||||||
|
|
|
@ -19,11 +19,16 @@ Get-Content ..\requirements.txt | Select-String -Pattern 'gmpy|miniupnpc' -NotMa
|
||||||
Add-Content requirements.txt "./gmpy-1.17-cp27-none-win32.whl"
|
Add-Content requirements.txt "./gmpy-1.17-cp27-none-win32.whl"
|
||||||
|
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
|
pip install ..\.
|
||||||
|
|
||||||
python set_build.py
|
python set_build.py
|
||||||
|
|
||||||
pyinstaller -y daemon.onefile.spec
|
pyinstaller -y daemon.onefile.spec
|
||||||
pyinstaller -y cli.onefile.spec
|
pyinstaller -y cli.onefile.spec
|
||||||
|
|
||||||
|
nuget install secure-file -ExcludeVersion
|
||||||
|
secure-file\tools\secure-file -decrypt .\lbry2.pfx.enc -secret "$env:pfx_key"
|
||||||
|
signtool.exe sign /f .\lbry2.pfx /p "$env:key_pass" /tr http://tsa.starfieldtech.com /td SHA256 /fd SHA256 dist\*.exe
|
||||||
|
|
||||||
python zip_daemon.py
|
python zip_daemon.py
|
||||||
python release_on_tag.py
|
python release_on_tag.py
|
BIN
build/lbry2.pfx.enc
Normal file
BIN
build/lbry2.pfx.enc
Normal file
Binary file not shown.
|
@ -51,7 +51,7 @@ class ClaimOutpoint(dict):
|
||||||
return (self['txid'], self['nout']) == (compare['txid'], compare['nOut'])
|
return (self['txid'], self['nout']) == (compare['txid'], compare['nOut'])
|
||||||
elif 'nout' in compare:
|
elif 'nout' in compare:
|
||||||
return (self['txid'], self['nout']) == (compare['txid'], compare['nout'])
|
return (self['txid'], self['nout']) == (compare['txid'], compare['nout'])
|
||||||
elif type(compare) in [str, unicode]:
|
elif isinstance(compare, (str, unicode)):
|
||||||
return compare == self.__repr__()
|
return compare == self.__repr__()
|
||||||
else:
|
else:
|
||||||
raise TypeError('cannot compare {}'.format(type(compare)))
|
raise TypeError('cannot compare {}'.format(type(compare)))
|
||||||
|
|
|
@ -241,7 +241,7 @@ class RequestHelper(object):
|
||||||
def _handle_incoming_blob(response_dict, peer, request):
|
def _handle_incoming_blob(response_dict, peer, request):
|
||||||
if request.response_identifier not in response_dict:
|
if request.response_identifier not in response_dict:
|
||||||
return InvalidResponseError("response identifier not in response")
|
return InvalidResponseError("response identifier not in response")
|
||||||
if type(response_dict[request.response_identifier]) != dict:
|
if not isinstance(response_dict[request.response_identifier], dict):
|
||||||
return InvalidResponseError("response not a dict. got %s" %
|
return InvalidResponseError("response not a dict. got %s" %
|
||||||
type(response_dict[request.response_identifier]))
|
type(response_dict[request.response_identifier]))
|
||||||
response = response_dict[request.response_identifier]
|
response = response_dict[request.response_identifier]
|
||||||
|
|
|
@ -63,16 +63,16 @@ class Bencode(Encoding):
|
||||||
@return: The encoded data
|
@return: The encoded data
|
||||||
@rtype: str
|
@rtype: str
|
||||||
"""
|
"""
|
||||||
if type(data) in (int, long):
|
if isinstance(data, (int, long)):
|
||||||
return 'i%de' % data
|
return 'i%de' % data
|
||||||
elif type(data) == str:
|
elif isinstance(data, str):
|
||||||
return '%d:%s' % (len(data), data)
|
return '%d:%s' % (len(data), data)
|
||||||
elif type(data) in (list, tuple):
|
elif isinstance(data, (list, tuple)):
|
||||||
encodedListItems = ''
|
encodedListItems = ''
|
||||||
for item in data:
|
for item in data:
|
||||||
encodedListItems += self.encode(item)
|
encodedListItems += self.encode(item)
|
||||||
return 'l%se' % encodedListItems
|
return 'l%se' % encodedListItems
|
||||||
elif type(data) == dict:
|
elif isinstance(data, dict):
|
||||||
encodedDictItems = ''
|
encodedDictItems = ''
|
||||||
keys = data.keys()
|
keys = data.keys()
|
||||||
keys.sort()
|
keys.sort()
|
||||||
|
@ -80,16 +80,16 @@ class Bencode(Encoding):
|
||||||
encodedDictItems += self.encode(key)
|
encodedDictItems += self.encode(key)
|
||||||
encodedDictItems += self.encode(data[key])
|
encodedDictItems += self.encode(data[key])
|
||||||
return 'd%se' % encodedDictItems
|
return 'd%se' % encodedDictItems
|
||||||
elif type(data) == float:
|
elif isinstance(data, float):
|
||||||
# This (float data type) is a non-standard extension to the original Bencode algorithm
|
# This (float data type) is a non-standard extension to the original Bencode algorithm
|
||||||
return 'f%fe' % data
|
return 'f%fe' % data
|
||||||
elif data == None:
|
elif data is None:
|
||||||
# This (None/NULL data type) is a non-standard extension
|
# This (None/NULL data type) is a non-standard extension
|
||||||
# to the original Bencode algorithm
|
# to the original Bencode algorithm
|
||||||
return 'n'
|
return 'n'
|
||||||
else:
|
else:
|
||||||
print data
|
print data
|
||||||
raise TypeError, "Cannot bencode '%s' object" % type(data)
|
raise TypeError("Cannot bencode '%s' object" % type(data))
|
||||||
|
|
||||||
def decode(self, data):
|
def decode(self, data):
|
||||||
""" Decoder implementation of the Bencode algorithm
|
""" Decoder implementation of the Bencode algorithm
|
||||||
|
@ -104,11 +104,11 @@ class Bencode(Encoding):
|
||||||
@rtype: int, list, dict or str
|
@rtype: int, list, dict or str
|
||||||
"""
|
"""
|
||||||
if len(data) == 0:
|
if len(data) == 0:
|
||||||
raise DecodeError, 'Cannot decode empty string'
|
raise DecodeError('Cannot decode empty string')
|
||||||
try:
|
try:
|
||||||
return self._decodeRecursive(data)[0]
|
return self._decodeRecursive(data)[0]
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
raise DecodeError, e.message
|
raise DecodeError(e.message)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _decodeRecursive(data, startIndex=0):
|
def _decodeRecursive(data, startIndex=0):
|
||||||
|
@ -118,14 +118,14 @@ class Bencode(Encoding):
|
||||||
"""
|
"""
|
||||||
if data[startIndex] == 'i':
|
if data[startIndex] == 'i':
|
||||||
endPos = data[startIndex:].find('e') + startIndex
|
endPos = data[startIndex:].find('e') + startIndex
|
||||||
return (int(data[startIndex + 1:endPos]), endPos + 1)
|
return int(data[startIndex + 1:endPos]), endPos + 1
|
||||||
elif data[startIndex] == 'l':
|
elif data[startIndex] == 'l':
|
||||||
startIndex += 1
|
startIndex += 1
|
||||||
decodedList = []
|
decodedList = []
|
||||||
while data[startIndex] != 'e':
|
while data[startIndex] != 'e':
|
||||||
listData, startIndex = Bencode._decodeRecursive(data, startIndex)
|
listData, startIndex = Bencode._decodeRecursive(data, startIndex)
|
||||||
decodedList.append(listData)
|
decodedList.append(listData)
|
||||||
return (decodedList, startIndex + 1)
|
return decodedList, startIndex + 1
|
||||||
elif data[startIndex] == 'd':
|
elif data[startIndex] == 'd':
|
||||||
startIndex += 1
|
startIndex += 1
|
||||||
decodedDict = {}
|
decodedDict = {}
|
||||||
|
@ -133,15 +133,15 @@ class Bencode(Encoding):
|
||||||
key, startIndex = Bencode._decodeRecursive(data, startIndex)
|
key, startIndex = Bencode._decodeRecursive(data, startIndex)
|
||||||
value, startIndex = Bencode._decodeRecursive(data, startIndex)
|
value, startIndex = Bencode._decodeRecursive(data, startIndex)
|
||||||
decodedDict[key] = value
|
decodedDict[key] = value
|
||||||
return (decodedDict, startIndex)
|
return decodedDict, startIndex
|
||||||
elif data[startIndex] == 'f':
|
elif data[startIndex] == 'f':
|
||||||
# This (float data type) is a non-standard extension to the original Bencode algorithm
|
# This (float data type) is a non-standard extension to the original Bencode algorithm
|
||||||
endPos = data[startIndex:].find('e') + startIndex
|
endPos = data[startIndex:].find('e') + startIndex
|
||||||
return (float(data[startIndex + 1:endPos]), endPos + 1)
|
return float(data[startIndex + 1:endPos]), endPos + 1
|
||||||
elif data[startIndex] == 'n':
|
elif data[startIndex] == 'n':
|
||||||
# This (None/NULL data type) is a non-standard extension
|
# This (None/NULL data type) is a non-standard extension
|
||||||
# to the original Bencode algorithm
|
# to the original Bencode algorithm
|
||||||
return (None, startIndex + 1)
|
return None, startIndex + 1
|
||||||
else:
|
else:
|
||||||
splitPos = data[startIndex:].find(':') + startIndex
|
splitPos = data[startIndex:].find(':') + startIndex
|
||||||
try:
|
try:
|
||||||
|
@ -151,4 +151,4 @@ class Bencode(Encoding):
|
||||||
startIndex = splitPos + 1
|
startIndex = splitPos + 1
|
||||||
endPos = startIndex + length
|
endPos = startIndex + length
|
||||||
bytes = data[startIndex:endPos]
|
bytes = data[startIndex:endPos]
|
||||||
return (bytes, endPos)
|
return bytes, endPos
|
||||||
|
|
|
@ -22,7 +22,7 @@ class RequestMessage(Message):
|
||||||
""" Message containing an RPC request """
|
""" Message containing an RPC request """
|
||||||
|
|
||||||
def __init__(self, nodeID, method, methodArgs, rpcID=None):
|
def __init__(self, nodeID, method, methodArgs, rpcID=None):
|
||||||
if rpcID == None:
|
if rpcID is None:
|
||||||
rpcID = generate_id()
|
rpcID = generate_id()
|
||||||
Message.__init__(self, rpcID, nodeID)
|
Message.__init__(self, rpcID, nodeID)
|
||||||
self.request = method
|
self.request = method
|
||||||
|
|
|
@ -93,13 +93,13 @@ class Node(object):
|
||||||
self.next_refresh_call = None
|
self.next_refresh_call = None
|
||||||
self.next_change_token_call = None
|
self.next_change_token_call = None
|
||||||
# Create k-buckets (for storing contacts)
|
# Create k-buckets (for storing contacts)
|
||||||
if routingTableClass == None:
|
if routingTableClass is None:
|
||||||
self._routingTable = routingtable.OptimizedTreeRoutingTable(self.id)
|
self._routingTable = routingtable.OptimizedTreeRoutingTable(self.id)
|
||||||
else:
|
else:
|
||||||
self._routingTable = routingTableClass(self.id)
|
self._routingTable = routingTableClass(self.id)
|
||||||
|
|
||||||
# Initialize this node's network access mechanisms
|
# Initialize this node's network access mechanisms
|
||||||
if networkProtocol == None:
|
if networkProtocol is None:
|
||||||
self._protocol = protocol.KademliaProtocol(self)
|
self._protocol = protocol.KademliaProtocol(self)
|
||||||
else:
|
else:
|
||||||
self._protocol = networkProtocol
|
self._protocol = networkProtocol
|
||||||
|
@ -107,7 +107,7 @@ class Node(object):
|
||||||
self.token_secret = self._generateID()
|
self.token_secret = self._generateID()
|
||||||
self.old_token_secret = None
|
self.old_token_secret = None
|
||||||
self.change_token()
|
self.change_token()
|
||||||
if dataStore == None:
|
if dataStore is None:
|
||||||
self._dataStore = datastore.DictDataStore()
|
self._dataStore = datastore.DictDataStore()
|
||||||
else:
|
else:
|
||||||
self._dataStore = dataStore
|
self._dataStore = dataStore
|
||||||
|
@ -207,7 +207,7 @@ class Node(object):
|
||||||
|
|
||||||
def expand_and_filter(result):
|
def expand_and_filter(result):
|
||||||
expanded_peers = []
|
expanded_peers = []
|
||||||
if type(result) == dict:
|
if isinstance(result, dict):
|
||||||
if blob_hash in result:
|
if blob_hash in result:
|
||||||
for peer in result[blob_hash]:
|
for peer in result[blob_hash]:
|
||||||
if self.lbryid != peer[6:]:
|
if self.lbryid != peer[6:]:
|
||||||
|
@ -353,7 +353,7 @@ class Node(object):
|
||||||
outerDf = defer.Deferred()
|
outerDf = defer.Deferred()
|
||||||
|
|
||||||
def checkResult(result):
|
def checkResult(result):
|
||||||
if type(result) == dict:
|
if isinstance(result, dict):
|
||||||
# We have found the value; now see who was the closest contact without it...
|
# We have found the value; now see who was the closest contact without it...
|
||||||
# ...and store the key/value pair
|
# ...and store the key/value pair
|
||||||
outerDf.callback(result)
|
outerDf.callback(result)
|
||||||
|
@ -454,7 +454,7 @@ class Node(object):
|
||||||
to fix this (perhaps use a stream from the Protocol class?)
|
to fix this (perhaps use a stream from the Protocol class?)
|
||||||
"""
|
"""
|
||||||
# Get the sender's ID (if any)
|
# Get the sender's ID (if any)
|
||||||
if originalPublisherID == None:
|
if originalPublisherID is None:
|
||||||
if '_rpcNodeID' in kwargs:
|
if '_rpcNodeID' in kwargs:
|
||||||
originalPublisherID = kwargs['_rpcNodeID']
|
originalPublisherID = kwargs['_rpcNodeID']
|
||||||
else:
|
else:
|
||||||
|
@ -471,7 +471,7 @@ class Node(object):
|
||||||
# raise TypeError, 'No contact info available'
|
# raise TypeError, 'No contact info available'
|
||||||
|
|
||||||
if ((self_store is False) and
|
if ((self_store is False) and
|
||||||
(not 'token' in value or not self.verify_token(value['token'], compact_ip))):
|
('token' not in value or not self.verify_token(value['token'], compact_ip))):
|
||||||
raise ValueError('Invalid or missing token')
|
raise ValueError('Invalid or missing token')
|
||||||
|
|
||||||
if 'port' in value:
|
if 'port' in value:
|
||||||
|
@ -584,7 +584,7 @@ class Node(object):
|
||||||
"""
|
"""
|
||||||
findValue = rpc != 'findNode'
|
findValue = rpc != 'findNode'
|
||||||
|
|
||||||
if startupShortlist == None:
|
if startupShortlist is None:
|
||||||
shortlist = self._routingTable.findCloseNodes(key, constants.alpha)
|
shortlist = self._routingTable.findCloseNodes(key, constants.alpha)
|
||||||
if key != self.id:
|
if key != self.id:
|
||||||
# Update the "last accessed" timestamp for the appropriate k-bucket
|
# Update the "last accessed" timestamp for the appropriate k-bucket
|
||||||
|
@ -776,7 +776,7 @@ class _IterativeFindHelper(object):
|
||||||
if self.key in self.find_value_result:
|
if self.key in self.find_value_result:
|
||||||
self.outer_d.callback(self.find_value_result)
|
self.outer_d.callback(self.find_value_result)
|
||||||
return
|
return
|
||||||
elif len(self.active_contacts) and self.find_value == False:
|
elif len(self.active_contacts) and self.find_value is False:
|
||||||
if self._is_all_done():
|
if self._is_all_done():
|
||||||
# TODO: Re-send the FIND_NODEs to all of the k closest nodes not already queried
|
# TODO: Re-send the FIND_NODEs to all of the k closest nodes not already queried
|
||||||
#
|
#
|
||||||
|
|
|
@ -20,11 +20,9 @@ class Publisher(object):
|
||||||
self.certificate_id = certificate_id
|
self.certificate_id = certificate_id
|
||||||
self.lbry_file = None
|
self.lbry_file = None
|
||||||
|
|
||||||
"""
|
|
||||||
Create lbry file and make claim
|
|
||||||
"""
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def create_and_publish_stream(self, name, bid, claim_dict, file_path):
|
def create_and_publish_stream(self, name, bid, claim_dict, file_path):
|
||||||
|
"""Create lbry file and make claim"""
|
||||||
log.info('Starting publish for %s', name)
|
log.info('Starting publish for %s', name)
|
||||||
file_name = os.path.basename(file_path)
|
file_name = os.path.basename(file_path)
|
||||||
with file_utils.get_read_handle(file_path) as read_handle:
|
with file_utils.get_read_handle(file_path) as read_handle:
|
||||||
|
@ -47,11 +45,9 @@ class Publisher(object):
|
||||||
yield self.lbry_file.save_status()
|
yield self.lbry_file.save_status()
|
||||||
defer.returnValue(claim_out)
|
defer.returnValue(claim_out)
|
||||||
|
|
||||||
"""
|
|
||||||
Make a claim without creating a lbry file
|
|
||||||
"""
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def publish_stream(self, name, bid, claim_dict):
|
def publish_stream(self, name, bid, claim_dict):
|
||||||
|
"""Make a claim without creating a lbry file"""
|
||||||
claim_out = yield self.make_claim(name, bid, claim_dict)
|
claim_out = yield self.make_claim(name, bid, claim_dict)
|
||||||
defer.returnValue(claim_out)
|
defer.returnValue(claim_out)
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ __version__ = '0.3.0'
|
||||||
def undecorated(o):
|
def undecorated(o):
|
||||||
"""Remove all decorators from a function, method or class"""
|
"""Remove all decorators from a function, method or class"""
|
||||||
# class decorator
|
# class decorator
|
||||||
if type(o) is type:
|
if isinstance(o, type):
|
||||||
return o
|
return o
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Reference in a new issue