Skip to content

Commit

Permalink
Reduced path Dependency from network package
Browse files Browse the repository at this point in the history
  • Loading branch information
anand-skss committed Jul 4, 2024
1 parent 65d2a37 commit ecf0ce6
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/network/tls.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import sys

import network.asyncore_pollchoose as asyncore
import paths
from network.advanceddispatcher import AdvancedDispatcher
from queues import receiveDataQueue

Expand Down Expand Up @@ -49,9 +48,9 @@ def __init__(self, _=None, sock=None, certfile=None, keyfile=None,
server_side=False, ciphers=sslProtocolCiphers):
self.want_read = self.want_write = True
self.certfile = certfile or os.path.join(
paths.codePath(), 'sslkeys', 'cert.pem')
self._codePath(), 'sslkeys', 'cert.pem')
self.keyfile = keyfile or os.path.join(
paths.codePath(), 'sslkeys', 'key.pem')
self._codePath(), 'sslkeys', 'key.pem')
self.server_side = server_side
self.ciphers = ciphers
self.tlsStarted = False
Expand Down Expand Up @@ -218,3 +217,13 @@ def tls_handshake(self):
self.set_state("connection_fully_established")
receiveDataQueue.put(self.destination)
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
if frozen == "macosx_app" else sys._MEIPASS)

Check failure on line 229 in src/network/tls.py

View check run for this annotation

PyBitmessage Code Quality Checks / Code Quality - pylint

E1101 / no-member

Module 'sys' has no '_MEIPASS' member

0 comments on commit ecf0ce6

Please sign in to comment.