diff --git a/msal_extensions/cache_lock.py b/msal_extensions/cache_lock.py index c6f95e2..5f61413 100644 --- a/msal_extensions/cache_lock.py +++ b/msal_extensions/cache_lock.py @@ -6,7 +6,6 @@ import logging import portalocker -from packaging.version import Version logger = logging.getLogger(__name__) @@ -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+', @@ -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 diff --git a/setup.py b/setup.py index 3cebcd3..d49bb23 100644 --- a/setup.py +++ b/setup.py @@ -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'], )