Include portalocker in imaplibutil.py

This patch include the usage of portalocker for Windows environments,
because fcntl is not available.

This patch is related to issue #37, issue 1.
This commit is contained in:
Rodolfo García Peñas (kix) 2021-07-24 22:01:27 +02:00
parent be752838c8
commit a6fd6b1ded

View File

@ -15,7 +15,6 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
import datetime import datetime
import os import os
import fcntl
import time import time
import subprocess import subprocess
import threading import threading
@ -29,6 +28,14 @@ from offlineimap import OfflineImapError
from offlineimap.ui import getglobalui from offlineimap.ui import getglobalui
from imaplib2 import IMAP4, IMAP4_SSL, InternalDate from imaplib2 import IMAP4, IMAP4_SSL, InternalDate
try:
import portalocker
except:
try:
import fcntl
except:
pass # Ok if this fails, we can do without.
class UsefulIMAPMixIn: class UsefulIMAPMixIn:
def __getselectedfolder(self): def __getselectedfolder(self):