Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hash/encrypt library searching #5804

Merged
merged 2 commits into from
Nov 10, 2016
Merged
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
42 changes: 25 additions & 17 deletions pokemongo_bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -979,51 +979,59 @@ def get_encryption_lib(self):
if _platform == "Windows" or _platform == "win32":
# Check if we are on 32 or 64 bit
if sys.maxsize > 2**32:
file_name = 'src/pgoapi/pgoapi/lib/encrypt64.dll'
file_name = 'encrypt64.dll'
else:
file_name = 'src/pgoapi/pgoapi/lib/encrypt32.dll'
file_name = 'encrypt32.dll'
if _platform.lower() == "darwin":
file_name= 'src/pgoapi/pgoapi/lib/libencrypt-osx-64.so'
file_name= 'libencrypt-osx-64.so'
if _platform.lower() == "linux" or _platform.lower() == "linux2":
file_name = 'src/pgoapi/pgoapi/lib/libencrypt-linux-x86-64.so'
file_name = 'libencrypt-linux-x86-64.so'
if self.config.encrypt_location == '':
path = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
else:
path = self.config.encrypt_location

full_path = path + '/'+ file_name
if not os.path.isfile(full_path):
full_path = ''
if os.path.isfile(path + '/' + file_name): # check encrypt_location or local dir first
full_path = path + '/' + file_name
elif os.path.isfile(path + '/src/pgoapi/pgoapi/lib/' + file_name): # if not found, check pgoapi lib folder
full_path = path + '/src/pgoapi/pgoapi/lib/' + file_name

if full_path == '':
self.logger.error(file_name + ' is not found! Please place it in the bots root directory or set encrypt_location in config.')
self.logger.info('Platform: '+ _platform + ' ' + file_name + ' directory: '+ path)
sys.exit(1)
else:
self.logger.info('Found '+ file_name +'! Platform: ' + _platform + ' ' + file_name + ' directory: ' + path)
self.logger.info('Found '+ file_name +'! Platform: ' + _platform + ' ' + file_name + ' directory: ' + full_path)

return full_path

def get_hash_lib(self):
if _platform == "Windows" or _platform == "win32":
# Check if we are on 32 or 64 bit
if sys.maxsize > 2**32:
file_name = 'src/pgoapi/pgoapi/lib/niantichash64.dll'
file_name = 'niantichash64.dll'
else:
file_name = 'src/pgoapi/pgoapi/lib/niantichash32.dll'
file_name = 'niantichash32.dll'
if _platform.lower() == "darwin":
file_name= 'src/pgoapi/pgoapi/lib/libniantichash-osx-64.so'
file_name= 'libniantichash-macos-64.dylib'
if _platform.lower() == "linux" or _platform.lower() == "linux2":
file_name = 'src/pgoapi/pgoapi/lib/libniantichash-linux-x86-64.so'
file_name = 'libniantichash-linux-x86-64.so'
if self.config.encrypt_location == '':
path = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
else:
path = self.config.encrypt_location

full_path = path + '/'+ file_name
if not os.path.isfile(full_path):
self.logger.error(file_name + ' is not found! Please place it in the bots root directory')
self.logger.info('Platform: '+ _platform + ' ' + file_name + ' directory: '+ path)
full_path = ''
if os.path.isfile(path + '/' + file_name): # check encrypt_location or local dir first
full_path = path + '/'+ file_name
elif os.path.isfile(path + '/src/pgoapi/pgoapi/lib/' + file_name): # if not found, check pgoapi lib folder
full_path = path + '/src/pgoapi/pgoapi/lib/' + file_name

if full_path == '':
self.logger.error(file_name + ' is not found! Please place it in the bots root directory or set encrypt_location in config.')
sys.exit(1)
else:
self.logger.info('Found '+ file_name +'! Platform: ' + _platform + ' ' + file_name + ' directory: ' + path)
self.logger.info('Found '+ file_name +'! Platform: ' + _platform + ' ' + file_name + ' directory: ' + full_path)

return full_path

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
numpy==1.11.0
networkx==1.11
-e git+https://github.com/pogodevorg/pgoapi.git/@v0.43.3-alpha#egg=pgoapi
-e git+https://github.com/sebastienvercammen/pgoapi.git#egg=pgoapi
geopy==1.11.0
geographiclib==1.46.3
protobuf==3.0.0b4
Expand Down