File tree Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change 23
23
import traceback
24
24
from argparse import ArgumentParser , RawDescriptionHelpFormatter
25
25
26
- import jsonpath_ng .ext
27
- from jsonpath_ng .exceptions import JsonPathLexerError , JsonPathParserError
28
-
29
26
from pass_import import Detecters , Managers , __version__
30
27
from pass_import .auto import AutoDetect
31
28
from pass_import .core import Cap
34
31
35
32
MANAGERS = Managers ()
36
33
34
+ try :
35
+ import jsonpath_ng .ext
36
+ from jsonpath_ng .exceptions import JsonPathLexerError , JsonPathParserError
37
+ JSONNG = True
38
+ except ImportError :
39
+ JSONNG = False
40
+
37
41
38
42
class ArgParser (ArgumentParser ):
39
43
"""Manages argument parsing and adds some defaults."""
@@ -437,6 +441,11 @@ def pass_filter(conf, entry):
437
441
if filter_expression is None :
438
442
return True
439
443
444
+ if not JSONNG :
445
+ message = ("--filter requires pass-import[filter] "
446
+ "or pass-import[all] to be installed" )
447
+ raise ImportError ('Missing packages. ' + message )
448
+
440
449
# Having end users write their JSONPath filter expression as if
441
450
# pass-import processes/filters entries in bulk, will allow end
442
451
# users filter expression to continue to work when/if bulk filter is
Original file line number Diff line number Diff line change @@ -50,7 +50,6 @@ install_requires =
50
50
pyaml
51
51
zxcvbn
52
52
requests
53
- jsonpath-ng
54
53
55
54
[options.entry_points]
56
55
console_scripts =
@@ -67,9 +66,13 @@ encrypted_otp =
67
66
cryptography
68
67
decrypt =
69
68
file-magic
70
- all =
69
+ filter =
70
+ jsonpath-ng
71
+ all =
71
72
defusedxml
72
73
pykeepass
73
74
secretstorage
74
75
cryptography
75
76
file-magic
77
+ jsonpath-ng
78
+
You can’t perform that action at this time.
0 commit comments