-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fa24258
commit 16408d4
Showing
4 changed files
with
96 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from logging.config import dictConfig | ||
from cryptoadvance.specter.cli import server | ||
import sys | ||
|
||
if __name__ == "__main__": | ||
# central and early configuring of logging see | ||
# https://flask.palletsprojects.com/en/1.1.x/logging/#basic-configuration | ||
dictConfig({ | ||
'version': 1, | ||
'formatters': {'default': { | ||
'format': '[%(asctime)s] %(levelname)s in %(module)s: %(message)s', | ||
}}, | ||
'handlers': {'wsgi': { | ||
'class': 'logging.StreamHandler', | ||
'stream': 'ext://flask.logging.wsgi_errors_stream', | ||
'formatter': 'default' | ||
}}, | ||
'root': { | ||
'level': 'INFO', | ||
'handlers': ['wsgi'] | ||
} | ||
}) | ||
if "--daemon" in sys.argv: | ||
print("Daemon mode is not supported in binaries yet") | ||
sys.exit(1) | ||
if "--debug" in sys.argv: | ||
print("Debug mode is useless in binary mode, don't use it") | ||
sys.exit(1) | ||
if "--hwibridge" not in sys.argv: | ||
sys.argv.append("--hwibridge") | ||
server() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# -*- mode: python ; coding: utf-8 -*- | ||
import platform | ||
import subprocess | ||
import mnemonic, os | ||
|
||
mnemonic_path = os.path.join(mnemonic.__path__[0], "wordlist") | ||
|
||
block_cipher = None | ||
|
||
binaries = [] | ||
if platform.system() == 'Windows': | ||
binaries = [("./windll/libusb-1.0.dll", ".")] | ||
elif platform.system() == 'Linux': | ||
if platform.processor() == 'aarch64': #ARM 64 bit | ||
binaries = [("/lib/aarch64-linux-gnu/libusb-1.0.so.0", ".")] | ||
else: | ||
binaries = [("/lib/x86_64-linux-gnu/libusb-1.0.so.0", ".")] | ||
elif platform.system() == 'Darwin': | ||
find_brew_libusb_proc = subprocess.Popen(['brew', '--prefix', 'libusb'], stdout=subprocess.PIPE) | ||
libusb_path = find_brew_libusb_proc.communicate()[0] | ||
binaries = [(libusb_path.rstrip().decode() + "/lib/libusb-1.0.dylib", ".")] | ||
|
||
a = Analysis(['hwibridge.py'], | ||
binaries=binaries, | ||
datas=[('../src/cryptoadvance/specter/templates', 'templates'), | ||
('../src/cryptoadvance/specter/static', 'static'), | ||
(mnemonic_path, 'mnemonic/wordlist'), | ||
], | ||
hiddenimports=[ | ||
'pkg_resources.py2_warn', | ||
'cryptoadvance.specter.config' | ||
], | ||
hookspath=['hooks/'], | ||
runtime_hooks=[], | ||
excludes=[], | ||
win_no_prefer_redirects=False, | ||
win_private_assemblies=False, | ||
cipher=block_cipher, | ||
noarchive=False) | ||
|
||
if platform.system() == 'Linux': | ||
import hwilib | ||
a.datas += Tree('../udev', prefix='hwilib/udev') | ||
|
||
pyz = PYZ(a.pure, a.zipped_data, | ||
cipher=block_cipher) | ||
exe = EXE(pyz, | ||
a.scripts, | ||
a.binaries, | ||
a.zipfiles, | ||
a.datas, | ||
[], | ||
name='hwibridge', | ||
debug=False, | ||
bootloader_ignore_signals=False, | ||
strip=False, | ||
upx=True, | ||
upx_exclude=[], | ||
runtime_tmpdir=None, | ||
console=True ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters