Fixed an "AssertionError: ensure_dir_exists" when checking library updates from simultaneous subprocesses // Resolve #3677

This commit is contained in:
Ivan Kravets
2020-09-19 19:29:51 +03:00
parent a384411a28
commit 2370e16f1b
2 changed files with 8 additions and 5 deletions

View File

@ -14,6 +14,7 @@ PlatformIO Core 5
- Fixed a "PermissionError: [WinError 5]" on Windows when external repository is used with `lib_deps <https://docs.platformio.org/page/projectconf/section_env_library.html#lib-deps>`__ option (`issue #3664 <https://github.com/platformio/platformio-core/issues/3664>`_)
- Fixed a "KeyError: 'versions'" when dependency does not exist in the registry (`issue #3666 <https://github.com/platformio/platformio-core/issues/3666>`_)
- Fixed an issue with GCC linker when "native" dev-platform is used in pair with library dependencies (`issue #3669 <https://github.com/platformio/platformio-core/issues/3669>`_)
- Fixed an "AssertionError: ensure_dir_exists" when checking library updates from simultaneous subprocesses (`issue #3677 <https://github.com/platformio/platformio-core/issues/3677>`_)
5.0.1 (2020-09-10)
~~~~~~~~~~~~~~~~~~

View File

@ -51,7 +51,7 @@ class BasePackageManager( # pylint: disable=too-many-public-methods
def __init__(self, pkg_type, package_dir):
self.pkg_type = pkg_type
self.package_dir = self.ensure_dir_exists(package_dir)
self.package_dir = package_dir
self._MEMORY_CACHE = {}
self._lockfile = None
@ -62,7 +62,9 @@ class BasePackageManager( # pylint: disable=too-many-public-methods
def lock(self):
if self._lockfile:
return
self.ensure_dir_exists(os.path.dirname(self.package_dir))
self._lockfile = LockFile(self.package_dir)
self.ensure_dir_exists(self.package_dir)
self._lockfile.acquire()
def unlock(self):
@ -91,10 +93,7 @@ class BasePackageManager( # pylint: disable=too-many-public-methods
@staticmethod
def ensure_dir_exists(path):
if not os.path.isdir(path):
try:
os.makedirs(path)
except: # pylint: disable=bare-except
pass
os.makedirs(path)
assert os.path.isdir(path)
return path
@ -193,6 +192,9 @@ class BasePackageManager( # pylint: disable=too-many-public-methods
return metadata
def get_installed(self):
if not os.path.isdir(self.package_dir):
return []
cache_key = "get_installed"
if self.memcache_get(cache_key):
return self.memcache_get(cache_key)