Reduced path Dependency from network package #2260

Open
anand-skss wants to merge 1 commits from anand-skss/test_case into v0.6

View File

@ -8,7 +8,6 @@ import ssl
import sys import sys
import network.asyncore_pollchoose as asyncore import network.asyncore_pollchoose as asyncore
import paths
from network.advanceddispatcher import AdvancedDispatcher from network.advanceddispatcher import AdvancedDispatcher
from queues import receiveDataQueue from queues import receiveDataQueue
@ -49,9 +48,9 @@ class TLSDispatcher(AdvancedDispatcher):
server_side=False, ciphers=sslProtocolCiphers): server_side=False, ciphers=sslProtocolCiphers):
self.want_read = self.want_write = True self.want_read = self.want_write = True
self.certfile = certfile or os.path.join( self.certfile = certfile or os.path.join(
paths.codePath(), 'sslkeys', 'cert.pem') self._codePath(), 'sslkeys', 'cert.pem')
self.keyfile = keyfile or os.path.join( self.keyfile = keyfile or os.path.join(
paths.codePath(), 'sslkeys', 'key.pem') self._codePath(), 'sslkeys', 'key.pem')
self.server_side = server_side self.server_side = server_side
self.ciphers = ciphers self.ciphers = ciphers
self.tlsStarted = False self.tlsStarted = False
@ -218,3 +217,13 @@ class TLSDispatcher(AdvancedDispatcher):
self.set_state("connection_fully_established") self.set_state("connection_fully_established")
receiveDataQueue.put(self.destination) receiveDataQueue.put(self.destination)
return False return False
def _codePath(self): # pylint: disable=no-self-use
"""Returns project dir path"""
frozen = getattr(sys, 'frozen', None)
if not frozen:
return os.path.dirname(os.path.dirname(__file__))
return (
os.environ.get('RESOURCEPATH')
# pylint: disable=protected-access, no-member
if frozen == "macosx_app" else sys._MEIPASS)