From a6fd6b1ded9f39d734239ba26fbf8df062f5d647 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20=28kix=29?= Date: Sat, 24 Jul 2021 22:01:27 +0200 Subject: [PATCH] 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. --- offlineimap/imaplibutil.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/offlineimap/imaplibutil.py b/offlineimap/imaplibutil.py index b29b019..5f6f6f9 100644 --- a/offlineimap/imaplibutil.py +++ b/offlineimap/imaplibutil.py @@ -15,7 +15,6 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA import datetime import os -import fcntl import time import subprocess import threading @@ -29,6 +28,14 @@ from offlineimap import OfflineImapError from offlineimap.ui import getglobalui 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: def __getselectedfolder(self):