Skip to content

Commit 7a864c5

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

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/network/tls.py

+11-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,12 @@ def tls_handshake(self):
218217
self.set_state("connection_fully_established")
219218
receiveDataQueue.put(self.destination)
220219
return False
220+
221+
def codePath(self):
222+
frozen = getattr(sys, 'frozen', None)
223+
if not frozen:
224+
return os.path.dirname(os.path.dirname(__file__))
225+
return (
226+
os.environ.get('RESOURCEPATH')
227+
# pylint: disable=protected-access
228+
if frozen == "macosx_app" else sys._MEIPASS)

0 commit comments

Comments
 (0)