diff options
author | Dusan Klinec <dusan.klinec@gmail.com> | 2018-11-29 04:22:52 +0100 |
---|---|---|
committer | Dusan Klinec <dusan.klinec@gmail.com> | 2018-12-04 18:38:18 +0100 |
commit | 65b9bca70e3aa0aabc135f952da3695fdab00918 (patch) | |
tree | 62b2e6d592520bd8d9faa04ace565ee498797b69 /src/device_trezor/trezor/tools/pb2cpp.py | |
parent | device/trezor: ask for KI sync on first refresh (diff) | |
download | monero-65b9bca70e3aa0aabc135f952da3695fdab00918.tar.xz |
device/trezor: python2 compatibility - bundle dependencies
Diffstat (limited to 'src/device_trezor/trezor/tools/pb2cpp.py')
-rw-r--r-- | src/device_trezor/trezor/tools/pb2cpp.py | 14 |
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" |