this way the check will succeed if requirements met

else it will fail with keyError exception, even though everything is satisfied.
This commit is contained in:
t88yop 2018-07-21 12:35:50 +02:00 committed by GitHub
parent 8537fbb2cc
commit 18206c5ea5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -136,25 +136,17 @@ if prereqs:
OPSYS = detectOS()
CMD = PACKAGE_MANAGER[OPSYS] if OPSYS in PACKAGE_MANAGER else 'UNKNOWN_INSTALLER'
for lhs, rhs in EXTRAS_REQUIRE.items():
if rhs and any([
EXTRAS_REQUIRE_DEPS[x][OPSYS]
#print("rhs is " , rhs)
try:
if rhs and any([ EXTRAS_REQUIRE_DEPS[x][OPSYS] for x in rhs if x in EXTRAS_REQUIRE_DEPS ]):
#print("x is: " , x ) ### too late
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
]):
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 x in EXTRAS_REQUIRE_DEPS ]), ])
print( "Optional dependency `pip install .[{}]` would require `{}`" , " to be run as root".format(lhs, rhs_cmd))
except KeyError: pass # all is satisfied - someone(TM) needs to do this properly...
if (not compiler or prereqs) and OPSYS in PACKAGE_MANAGER:
print("You can install the missing dependencies by running, as root:")