Skip to content

Commit f19c225

Browse files
authored
Merge pull request #320 from screamerbg/0.9-polishing
Convert '-' to '_' when matching pip installed packages and requirements.txt
2 parents 3c0dfc7 + 77dabcb commit f19c225

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mbed/mbed.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1221,9 +1221,9 @@ def check_requirements(self, show_warning=False):
12211221
try:
12221222
with open(os.path.join(req_path, req_file), 'r') as f:
12231223
import pip
1224-
installed_packages = [package.project_name.lower() for package in pip.get_installed_distributions(local_only=True)]
1224+
installed_packages = [re.sub(r'-', '_', package.project_name.lower()) for package in pip.get_installed_distributions(local_only=True)]
12251225
for line in f.read().splitlines():
1226-
pkg = re.sub(r'^([\w-]+).*$', r'\1', line).lower()
1226+
pkg = re.sub(r'-', '_', re.sub(r'^([\w-]+).*$', r'\1', line).lower())
12271227
if not pkg in installed_packages:
12281228
missing.append(pkg)
12291229

0 commit comments

Comments
 (0)