From e17e963dc06aa1f70fe826bd715885ab5a0320bb Mon Sep 17 00:00:00 2001 From: Abdullah Selek Date: Tue, 12 Dec 2017 15:04:52 +0100 Subject: [PATCH 1/5] Centralize dependencies in a separate file --- .travis.install-dependencies.sh | 2 +- requirements.txt | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 requirements.txt diff --git a/.travis.install-dependencies.sh b/.travis.install-dependencies.sh index 052d95c3..0f95f18e 100644 --- a/.travis.install-dependencies.sh +++ b/.travis.install-dependencies.sh @@ -21,4 +21,4 @@ sudo gdebi -nq armory.deb # Download, compile, and install prerequisites for bitcoinj wallets curl -fsS --retry 10 https://bootstrap.pypa.io/get-pip.py | sudo python -sudo /usr/local/bin/pip install -q protobuf scrypt pylibscrypt coincurve pysha3 green +sudo /usr/local/bin/pip install -qr requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..1712a57f --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +protobuf +scrypt +pylibscrypt +coincurve +pysha3 +green From c1f4c70e1b3caecc5577f41597bbca7183afd0ce Mon Sep 17 00:00:00 2001 From: Christopher Gurnee Date: Tue, 12 Dec 2017 10:13:00 -0500 Subject: [PATCH 2/5] update INSTALL & fix calcsize for earlier Pythons closes #161 --- btcrecover/btcrpass.py | 4 ++-- docs/INSTALL.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/btcrecover/btcrpass.py b/btcrecover/btcrpass.py index ef839d98..53b6df58 100644 --- a/btcrecover/btcrpass.py +++ b/btcrecover/btcrpass.py @@ -49,7 +49,7 @@ def full_version(): return "btcrecover {} on Python {} {}-bit, {}-bit unicodes, {}-bit ints".format( __version__, ".".join(str(i) for i in sys.version_info[:3]), - calcsize("P") * 8, + calcsize(b"P") * 8, sys.maxunicode.bit_length(), sys.maxint.bit_length() + 1 ) @@ -310,7 +310,7 @@ def add_armory_library_path(): armory_path = progfiles_path + r"\Armory" sys.path.extend((armory_path, armory_path + r"\library.zip")) # 64-bit Armory might install into the 32-bit directory; if this is 64-bit Python look in both - if struct.calcsize('P') * 8 == 64: # calcsize('P') is a pointer's size in bytes + if struct.calcsize(b"P") * 8 == 64: # calcsize('P') is a pointer's size in bytes assert not progfiles_path.endswith("(x86)"), "ProgramFiles doesn't end with '(x86)' on x64 Python" progfiles_path += " (x86)" armory_path = progfiles_path + r"\Armory" diff --git a/docs/INSTALL.md b/docs/INSTALL.md index 6d481265..365ee192 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -48,7 +48,7 @@ Download and run the latest version of the pywin32 installer for Python 2.7, eit ##### Windows ##### -Visit the Python download page here: , and click the link for the latest **Python 2** release. Download and run either the `Windows x86 MSI installer` for the 32-bit version of Python, or the `Windows x86-64 MSI installer` for the 64-bit one (for Armory wallets, be sure to choose the correct one as noted above). Modern PCs should use the 64-bit version, however if you're unsure which one is compatible with your PC, choose the 32-bit one. +Visit the Python download page here: , and click the link for the latest **Python 2.7** release near the top of the page under the heading *Python Releases for Windows*. Download and run either the `Windows x86 MSI installer` for the 32-bit version of Python, or the `Windows x86-64 MSI installer` for the 64-bit one (for Armory wallets, be sure to choose the correct one as noted above). Modern PCs should use the 64-bit version, however if you're unsure which one is compatible with your PC, choose the 32-bit one. ##### Linux ##### From 3ed93b69a8c5b23a8f697fb6bda71675a9e4d1c0 Mon Sep 17 00:00:00 2001 From: Christopher Gurnee Date: Fri, 15 Dec 2017 19:43:17 -0500 Subject: [PATCH 3/5] update libsodium version in INSTALL.md [ci skip] --- docs/INSTALL.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/INSTALL.md b/docs/INSTALL.md index 365ee192..5cf21146 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -4,7 +4,7 @@ Just download the latest version from + 2. Download this libsodium zip file, and extract it to a temporary location: 3. Find the correct `libsodium.dll` file from the extracted files, it will be located at one of these two paths: @@ -122,8 +122,8 @@ then try this instead: 5. Download and install one of the two update packages below from Microsoft, either the 32-bit version or the 64-bit version (the second) to match the version of Python that you've installed. - * [Microsoft Visual C++ Redistributable for Visual Studio 2017 **32-bit**](https://go.microsoft.com/fwlink/?LinkId=746572) - * [Microsoft Visual C++ Redistributable for Visual Studio 2017 **64-bit**](https://go.microsoft.com/fwlink/?LinkId=746571) + * [Microsoft Visual C++ Redistributable for Visual Studio 2017 **32-bit**](https://go.microsoft.com/fwlink/?LinkId=746571) + * [Microsoft Visual C++ Redistributable for Visual Studio 2017 **64-bit**](https://go.microsoft.com/fwlink/?LinkId=746572) ##### Linux ##### From 13f3e55571cde07bb78a5e4d12991ff083ca16ee Mon Sep 17 00:00:00 2001 From: Christopher Gurnee Date: Fri, 15 Dec 2017 19:59:18 -0500 Subject: [PATCH 4/5] save & restore warnings correctly in unit tests --- btcrecover/test/test_passwords.py | 5 +++-- btcrecover/test/test_seeds.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/btcrecover/test/test_passwords.py b/btcrecover/test/test_passwords.py index 12268a72..6b8e7296 100644 --- a/btcrecover/test/test_passwords.py +++ b/btcrecover/test/test_passwords.py @@ -44,7 +44,8 @@ class NonClosingBase(object): def setUpModule(): global orig_warnings, tstr, tchr, utf8_opt, BytesIO, StringIO, BytesIONonClosing, StringIONonClosing - orig_warnings = warnings.filters[:] # the slice notation takes a shallow copy + orig_warnings = warnings.catch_warnings() + orig_warnings.__enter__() # save the current warnings settings (it's a context manager) # Convert warnings to errors: warnings.simplefilter("error") # except this from Intel's OpenCL compiler: @@ -89,7 +90,7 @@ def close(self): pass def tearDownModule(): global tstr tstr = None - warnings.filters[:] = orig_warnings # the slice notation replaces the list contents, not the list itself + orig_warnings.__exit__(None, None, None) # restore the original warnings settings WALLET_DIR = os.path.join(os.path.dirname(__file__), "test-wallets") diff --git a/btcrecover/test/test_seeds.py b/btcrecover/test/test_seeds.py index 390c28e5..546a73fe 100644 --- a/btcrecover/test/test_seeds.py +++ b/btcrecover/test/test_seeds.py @@ -40,12 +40,13 @@ def setUpModule(): global orig_warnings - orig_warnings = warnings.filters[:] # the slice notation takes a shallow copy + orig_warnings = warnings.catch_warnings() + orig_warnings.__enter__() # save the current warnings settings (it's a context manager) # Convert warnings to errors: warnings.simplefilter("error") def tearDownModule(): - warnings.filters[:] = orig_warnings # the slice notation replaces the list contents, not the list itself + orig_warnings.__exit__(None, None, None) # restore the original warnings settings class TestRecoveryFromWallet(unittest.TestCase): From c777baeedeb1945b6eb95446f76d4d9c7d8e38b7 Mon Sep 17 00:00:00 2001 From: Abdullah Selek Date: Tue, 12 Dec 2017 15:04:52 +0100 Subject: [PATCH 5/5] Centralize dependencies in a separate file --- .travis.install-dependencies.sh | 2 +- requirements.txt | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 requirements.txt diff --git a/.travis.install-dependencies.sh b/.travis.install-dependencies.sh index 052d95c3..0f95f18e 100644 --- a/.travis.install-dependencies.sh +++ b/.travis.install-dependencies.sh @@ -21,4 +21,4 @@ sudo gdebi -nq armory.deb # Download, compile, and install prerequisites for bitcoinj wallets curl -fsS --retry 10 https://bootstrap.pypa.io/get-pip.py | sudo python -sudo /usr/local/bin/pip install -q protobuf scrypt pylibscrypt coincurve pysha3 green +sudo /usr/local/bin/pip install -qr requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..1712a57f --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +protobuf +scrypt +pylibscrypt +coincurve +pysha3 +green