From 41d99764c6fa72e08227c41c7e2774eeacdcc3cd Mon Sep 17 00:00:00 2001 From: matejcik Date: Fri, 4 May 2018 15:54:23 +0200 Subject: [PATCH] build: reorganize requirements, mark hidapi as optional This drops the command line options. `libusb` is now required unconditionally (it's cffi so no harm there). hidapi is an extra. You either need to install it manually, or specify it in your requirements.txt like so: trezor[hidapi] >= 0.9.2 --- requirements-dev.txt | 4 ++++ requirements-optional.txt | 1 + requirements.txt | 1 - setup.py | 15 ++++----------- 4 files changed, 9 insertions(+), 12 deletions(-) create mode 100644 requirements-dev.txt create mode 100644 requirements-optional.txt diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 000000000..c2b9f5a64 --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,4 @@ +-r requirements.txt +-r requirements-optional.txt +pytest>=3.5.0 +mock>=2.0.0 diff --git a/requirements-optional.txt b/requirements-optional.txt new file mode 100644 index 000000000..94276761f --- /dev/null +++ b/requirements-optional.txt @@ -0,0 +1 @@ +hidapi >= 0.7.99.post20 diff --git a/requirements.txt b/requirements.txt index be94d06d9..7f09fe18c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,5 @@ mnemonic>=0.17 requests>=2.4.0 click>=6.2 pyblake2>=0.9.3 -hidapi>=0.7.99.post20 libusb1>=1.6.4 rlp>=0.6.0 diff --git a/setup.py b/setup.py index bb186dca1..41bc92375 100755 --- a/setup.py +++ b/setup.py @@ -15,19 +15,9 @@ install_requires = [ 'click>=6.2', 'pyblake2>=0.9.3', 'rlp>=0.6.0', + 'libusb1>=1.6.4', ] -import sys -if '--disable-hidapi' in sys.argv: - sys.argv.remove('--disable-hidapi') -else: - install_requires.append('hidapi>=0.7.99.post20') - -if '--disable-libusb' in sys.argv: - sys.argv.remove('--disable-libusb') -else: - install_requires.append('libusb1>=1.6.4') - from trezorlib import __version__ as VERSION @@ -97,6 +87,9 @@ setup( }, scripts=['trezorctl'], install_requires=install_requires, + extras_require={ + 'hidapi': ['hidapi>=0.7.99.post20'], + }, python_requires='>=3.3', include_package_data=True, zip_safe=False,