Skip to content

Commit f203089

Browse files
committed
Reduced path Dependency from network package
1 parent 65d2a37 commit f203089

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/network/tls.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import sys
99

1010
import network.asyncore_pollchoose as asyncore
11-
import paths
1211
from network.advanceddispatcher import AdvancedDispatcher
1312
from queues import receiveDataQueue
1413

@@ -49,9 +48,9 @@ def __init__(self, _=None, sock=None, certfile=None, keyfile=None,
4948
server_side=False, ciphers=sslProtocolCiphers):
5049
self.want_read = self.want_write = True
5150
self.certfile = certfile or os.path.join(
52-
paths.codePath(), 'sslkeys', 'cert.pem')
51+
self._codePath(), 'sslkeys', 'cert.pem')
5352
self.keyfile = keyfile or os.path.join(
54-
paths.codePath(), 'sslkeys', 'key.pem')
53+
self._codePath(), 'sslkeys', 'key.pem')
5554
self.server_side = server_side
5655
self.ciphers = ciphers
5756
self.tlsStarted = False
@@ -218,3 +217,13 @@ def tls_handshake(self):
218217
self.set_state("connection_fully_established")
219218
receiveDataQueue.put(self.destination)
220219
return False
220+
221+
def _codePath(self): # pylint: disable=no-self-use
222+
"""Returns project dir path"""
223+
frozen = getattr(sys, 'frozen', None)
224+
if not frozen:
225+
return os.path.dirname(os.path.dirname(__file__))
226+
return (
227+
os.environ.get('RESOURCEPATH')
228+
# pylint: disable=protected-access, no-member
229+
if frozen == "macosx_app" else sys._MEIPASS)

0 commit comments

Comments
 (0)