From d2a340d012efbeaa9d55ab996a8122241035278d Mon Sep 17 00:00:00 2001 From: navjot Date: Wed, 25 Nov 2020 19:52:27 +0530 Subject: [PATCH] implemented dependency checks in checkdeps module --- checkdeps.py | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/checkdeps.py b/checkdeps.py index c3dedc1d..619cd668 100755 --- a/checkdeps.py +++ b/checkdeps.py @@ -144,20 +144,23 @@ for lhs, rhs in EXTRAS_REQUIRE.items(): for x in rhs if x in EXTRAS_REQUIRE_DEPS ]): - rhs_cmd = ''.join([ - CMD, - ' ', - ' '.join([ - ''. join([ - xx for xx in EXTRAS_REQUIRE_DEPS[x][OPSYS] - ]) - for x in rhs - if x in EXTRAS_REQUIRE_DEPS - ]), - ]) - print( - "Optional dependency `pip install .[{}]` would require `{}`" - " to be run as root".format(lhs, rhs_cmd)) + try: + import_module(lhs) + except Exception as e: + rhs_cmd = ''.join([ + CMD, + ' ', + ' '.join([ + ''. join([ + xx for xx in EXTRAS_REQUIRE_DEPS[x][OPSYS] + ]) + for x in rhs + if x in EXTRAS_REQUIRE_DEPS + ]), + ]) + 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: print("You can install the missing dependencies by running, as root:")