Fix dependency checks for optional modules #1691

Merged
navjotcis merged 1 commits from bug-fixes15 into v0.6 2020-12-19 19:07:53 +01:00

View File

@ -144,20 +144,23 @@ for lhs, rhs in EXTRAS_REQUIRE.items():
for x in rhs for x in rhs
if x in EXTRAS_REQUIRE_DEPS if x in EXTRAS_REQUIRE_DEPS
]): ]):
rhs_cmd = ''.join([ try:
CMD, import_module(lhs)
' ', except Exception as e:
' '.join([ rhs_cmd = ''.join([
''. join([ CMD,
xx for xx in EXTRAS_REQUIRE_DEPS[x][OPSYS] ' ',
]) ' '.join([
for x in rhs ''. join([
if x in EXTRAS_REQUIRE_DEPS xx for xx in EXTRAS_REQUIRE_DEPS[x][OPSYS]
]), ])
]) for x in rhs
print( if x in EXTRAS_REQUIRE_DEPS
"Optional dependency `pip install .[{}]` would require `{}`" ]),
" to be run as root".format(lhs, rhs_cmd)) ])
print(
"Optional dependency `pip install .[{}]` would require `{}`"
" to be run as root".format(lhs, rhs_cmd))
if (not compiler or prereqs) and OPSYS in PACKAGE_MANAGER: if (not compiler or prereqs) and OPSYS in PACKAGE_MANAGER:
print("You can install the missing dependencies by running, as root:") print("You can install the missing dependencies by running, as root:")