File tree Expand file tree Collapse file tree 1 file changed +24
-2
lines changed
Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change 1515import tempfile
1616from collections import deque
1717
18- from filelock import FileLock
19-
2018from can import Message , CanError , BusABC
2119
2220logger = logging .getLogger (__name__ )
3230 ics = None
3331
3432
33+ try :
34+ from filelock import FileLock
35+ except ImportError as ie :
36+
37+ logger .warning (
38+ "Using ICS NeoVi can backend without the "
39+ "filelock module installed may cause some issues!: %s" ,
40+ ie ,
41+ )
42+
43+ class FileLock :
44+ """Dummy file lock that do not actually do anything"""
45+
46+ def __init__ (self , lock_file , timeout = - 1 ):
47+ self ._lock_file = lock_file
48+ self .timeout = timeout
49+
50+ def __enter__ (self ):
51+ return self
52+
53+ def __exit__ (self , exc_type , exc_val , exc_tb ):
54+ return None
55+
56+
3557# Use inter-process mutex to prevent concurrent device open.
3658# When neoVI server is enabled, there is an issue with concurrent device open.
3759open_lock = FileLock (os .path .join (tempfile .gettempdir (), "neovi.lock" ))
You can’t perform that action at this time.
0 commit comments