Skip to content

Commit

Permalink
Set lower bound 1.4 for portalocker dependency, drop packaging as…
Browse files Browse the repository at this point in the history
… a result
  • Loading branch information
akx committed Dec 22, 2023
1 parent 4d37293 commit 9d7636e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
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'],
)

0 comments on commit 9d7636e

Please sign in to comment.