Skip to content

Commit 2370e16

Browse files
committed
Fixed an "AssertionError: ensure_dir_exists" when checking library updates from simultaneous subprocesses // Resolve platformio#3677
1 parent a384411 commit 2370e16

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

HISTORY.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ PlatformIO Core 5
1414
- 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>`_)
1515
- Fixed a "KeyError: 'versions'" when dependency does not exist in the registry (`issue #3666 <https://github.com/platformio/platformio-core/issues/3666>`_)
1616
- 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>`_)
17+
- Fixed an "AssertionError: ensure_dir_exists" when checking library updates from simultaneous subprocesses (`issue #3677 <https://github.com/platformio/platformio-core/issues/3677>`_)
1718

1819
5.0.1 (2020-09-10)
1920
~~~~~~~~~~~~~~~~~~

platformio/package/manager/base.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class BasePackageManager( # pylint: disable=too-many-public-methods
5151

5252
def __init__(self, pkg_type, package_dir):
5353
self.pkg_type = pkg_type
54-
self.package_dir = self.ensure_dir_exists(package_dir)
54+
self.package_dir = package_dir
5555
self._MEMORY_CACHE = {}
5656

5757
self._lockfile = None
@@ -62,7 +62,9 @@ def __init__(self, pkg_type, package_dir):
6262
def lock(self):
6363
if self._lockfile:
6464
return
65+
self.ensure_dir_exists(os.path.dirname(self.package_dir))
6566
self._lockfile = LockFile(self.package_dir)
67+
self.ensure_dir_exists(self.package_dir)
6668
self._lockfile.acquire()
6769

6870
def unlock(self):
@@ -91,10 +93,7 @@ def is_system_compatible(value):
9193
@staticmethod
9294
def ensure_dir_exists(path):
9395
if not os.path.isdir(path):
94-
try:
95-
os.makedirs(path)
96-
except: # pylint: disable=bare-except
97-
pass
96+
os.makedirs(path)
9897
assert os.path.isdir(path)
9998
return path
10099

@@ -193,6 +192,9 @@ def build_metadata(self, pkg_dir, spec, vcs_revision=None):
193192
return metadata
194193

195194
def get_installed(self):
195+
if not os.path.isdir(self.package_dir):
196+
return []
197+
196198
cache_key = "get_installed"
197199
if self.memcache_get(cache_key):
198200
return self.memcache_get(cache_key)

0 commit comments

Comments
 (0)