Skip to content

Commit 1cb9339

Browse files
committed
Fixed Python module probing to check for the module name than the full requirements string
1 parent 5283e77 commit 1cb9339

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

mbed/mbed.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,10 +1157,13 @@ def post_action(self):
11571157
import pkgutil
11581158
with open(os.path.join(mbed_os_path, fname), 'r') as f:
11591159
for line in f.read().splitlines():
1160-
if pkgutil.find_loader(line) is None:
1161-
missing.append(line)
1160+
pkg = re.sub(r'^([\w-]+).*$', r'\1', line)
1161+
if pkgutil.find_loader(pkg) is None:
1162+
missing.append(pkg)
11621163
except IOError:
11631164
pass
1165+
except ImportError:
1166+
pass
11641167

11651168
if len(missing):
11661169
warning(
@@ -1355,7 +1358,7 @@ def import_(url, path=None, ignore=False, depth=None, protocol=None, top=True):
13551358
if ignore:
13561359
warning(err)
13571360
else:
1358-
error(err, e[0])
1361+
error(err, 1)
13591362

13601363
repo.sync()
13611364

0 commit comments

Comments
 (0)