Skip to content

Commit

Permalink
Fixed an "AssertionError: ensure_dir_exists" when checking library up…
Browse files Browse the repository at this point in the history
…dates from simultaneous subprocesses // Resolve #3677
  • Loading branch information
ivankravets committed Sep 19, 2020
1 parent a384411 commit 2370e16
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
~~~~~~~~~~~~~~~~~~
Expand Down
12 changes: 7 additions & 5 deletions platformio/package/manager/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -62,7 +62,9 @@ def __init__(self, pkg_type, package_dir):
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):
Expand Down Expand Up @@ -91,10 +93,7 @@ def is_system_compatible(value):
@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

Expand Down Expand Up @@ -193,6 +192,9 @@ def build_metadata(self, pkg_dir, spec, vcs_revision=None):
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)
Expand Down

0 comments on commit 2370e16

Please sign in to comment.