Skip to content

Commit 6a55d19

Browse files
On second thoughts, adding a dependency on pyscard was a bad idea
1 parent 997dadc commit 6a55d19

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

ledgerblue/comm.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424

2525
import hid
2626
import nfc
27-
from smartcard.System import readers
28-
from smartcard.util import toBytes
2927

3028
from .BleComm import BleDevice
3129
from .commException import CommException
@@ -66,10 +64,15 @@
6664
if "LEDGER_BLE_PROXY" in os.environ:
6765
BLE_PROXY = True
6866

69-
# Force use of MCUPROXY if required
7067
PCSC = None
7168
if "PCSC" in os.environ and len(os.environ["PCSC"]) != 0:
7269
PCSC = os.environ["PCSC"]
70+
try:
71+
# Don't force all users to install pyscard
72+
from smartcard.System import readers
73+
except ImportError:
74+
PCSC = None
75+
7376

7477
def get_possible_error_cause(sw):
7578
cause_map = {
@@ -295,7 +298,7 @@ def getDongle(debug=False):
295298
return DongleNFC(debug)
296299
elif BLE_PROXY:
297300
return DongleBLE(debug)
298-
elif PCSC:
301+
elif PCSC is not None:
299302
# Use the first pcsc reader with a card inserted
300303
connection = None
301304
for reader in readers():

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ dependencies = [
4343
"nfcpy>=1.0.4",
4444
"bleak>=0.20.1",
4545
"pycryptodome>=3.18.0",
46-
"python-gnupg>=0.5.0",
47-
"pyscard>=2.2.2"
46+
"python-gnupg>=0.5.0"
4847
]
4948

5049
[tool.setuptools]

0 commit comments

Comments
 (0)