Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions tumblebit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import ctypes.util
import logging
from platform import system
import config

###########################################################################
## CTypes -- Function Definitions
Expand All @@ -24,12 +25,18 @@
########################################################

# Change path to where libressl library is
# TODO: Add an option to specify the path in some sort of
# config file.
if(system() == "Darwin"):
path = "/usr/local/opt/libressl/lib/libssl.dylib"
try:
config.LIBRESSL_PATH

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

python noob here but why not path = config.LIBRESSL_PATH and removing the else at the end ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe if config.LIBRESSL_PATH isn't set i.e. commented out in the config it will throw a NameError, that was my thinking

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but path = config.LIBRESSL_PATH should as well right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see what you're saying. set the path in the try statement instead of in else madness
`

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should include this change in your updated pull request.

except NameError:
# doesn't print err, sets default. when the path is loaded if location
# does not exist will error. Consider warning here to make easy to
# find config
if(system() == "Darwin"):
path = "/usr/local/opt/libressl/lib/libssl.dylib"
else:
path = "/usr/local/lib/libssl.so"
else:
path = "/usr/local/lib/libssl.so"
path = config.LIBRESSL_PATH

_ssl = ctypes.cdll.LoadLibrary(path)
_ssl.SSL_load_error_strings()
Expand Down
3 changes: 3 additions & 0 deletions tumblebit/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
LIBRESSL_PATH = "/usr/local/lib/libssl.so"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be commented out. The user should uncomment and change to the correct path if the default paths don't work. Will mention this in the README.