aboutsummaryrefslogtreecommitdiff
path: root/src/device_trezor/trezor/tools/pb2cpp.py
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2018-12-12 11:53:42 +0200
committerRiccardo Spagni <ric@spagni.net>2018-12-12 11:53:42 +0200
commit0b31baf6e4ce272b0b65e9d5337d1a4c933471cb (patch)
tree64d74190c831dc7b296d9ef1e6ae8c62501ca490 /src/device_trezor/trezor/tools/pb2cpp.py
parentMerge pull request #4787 (diff)
parentdevice/trezor: device/trezor: correct device initialization, status check (diff)
downloadmonero-0b31baf6e4ce272b0b65e9d5337d1a4c933471cb.tar.xz
Merge pull request #4839
d71f89e2 device/trezor: device/trezor: correct device initialization, status check (Dusan Klinec) 65b9bca7 device/trezor: python2 compatibility - bundle dependencies (Dusan Klinec) 9cf636af device/trezor: ask for KI sync on first refresh (Dusan Klinec) d21dad70 device: enable to use multiple independent device wallets (Dusan Klinec) 318cc784 device/trezor: passphrase entry on host (Dusan Klinec)
Diffstat (limited to 'src/device_trezor/trezor/tools/pb2cpp.py')
-rw-r--r--src/device_trezor/trezor/tools/pb2cpp.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/device_trezor/trezor/tools/pb2cpp.py b/src/device_trezor/trezor/tools/pb2cpp.py
index 4d7cc775f..3e0318ea5 100644
--- a/src/device_trezor/trezor/tools/pb2cpp.py
+++ b/src/device_trezor/trezor/tools/pb2cpp.py
@@ -14,12 +14,18 @@ import hashlib
try:
from tempfile import TemporaryDirectory
except:
- # Py2 backward compatibility, optionally installed by user
- # pip install backports.tempfile
+ # Py2 backward compatibility, using bundled sources.
+ # Original source: pip install backports.tempfile
try:
- from backports.tempfile import TemporaryDirectory
+ # Try bundled python version
+ import sys
+ sys.path.append(os.path.dirname(__file__))
+ from py2backports.tempfile import TemporaryDirectory
+
except:
- raise EnvironmentError('TemporaryDirectory could not be imported. Try: pip install backports.tempfile')
+ raise EnvironmentError('Python 2.7+ or 3.4+ is required. '
+ 'TemporaryDirectory is not available in Python 2.'
+ 'Try to specify python to use, e.g.: "export TREZOR_PYTHON=`which python3`"')
AUTO_HEADER = "# Automatically generated by pb2cpp\n"