Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions msal_extensions/cache_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import logging

import portalocker
from packaging.version import Version


logger = logging.getLogger(__name__)
Expand All @@ -19,9 +18,6 @@ class CrossPlatLock(object):
"""
def __init__(self, lockfile_path):
self._lockpath = lockfile_path
# Support for passing through arguments to the open syscall was added in v1.4.0
open_kwargs = ({'buffering': 0}
if Version(portalocker.__version__) >= Version("1.4.0") else {})
self._lock = portalocker.Lock(
lockfile_path,
mode='wb+',
Expand All @@ -30,7 +26,10 @@ def __init__(self, lockfile_path):
# More information here:
# https://docs.python.org/3/library/fcntl.html#fcntl.lockf
flags=portalocker.LOCK_EX | portalocker.LOCK_NB,
**open_kwargs)
# Support for passing through arguments to the open syscall
# was added in Portalocker v1.4.0 (2019-02-11).
buffering=0,
)

def _try_to_create_lock_file(self):
timeout = 5
Expand Down
9 changes: 1 addition & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,10 @@
python_requires=">=3.7",
install_requires=[
'msal>=0.4.1,<2.0.0',

"portalocker<3,>=1.0;platform_system!='Windows'",
"portalocker<3,>=1.6;platform_system=='Windows'",
'portalocker<3,>=1.4',

## We choose to NOT define a hard dependency on this.
# "pygobject>=3,<4;platform_system=='Linux'",

# Packaging package uses YY.N versioning so we have no upperbound to pin.
# Neither do we need lowerbound because its `Version` API existed since its first release
# https://github.com/pypa/packaging/blame/14.0/packaging/version.py
'packaging',
],
tests_require=['pytest'],
)