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

@ -134,27 +134,19 @@ if prereqs:
# Install the system dependencies of optional extras_require components # Install the system dependencies of optional extras_require components
OPSYS = detectOS() OPSYS = detectOS()
CMD = PACKAGE_MANAGER[OPSYS] if OPSYS in PACKAGE_MANAGER else 'UNKNOWN_INSTALLER' CMD = PACKAGE_MANAGER[OPSYS] if OPSYS in PACKAGE_MANAGER else 'UNKNOWN_INSTALLER'
for lhs, rhs in EXTRAS_REQUIRE.items(): for lhs, rhs in EXTRAS_REQUIRE.items():
if rhs and any([ #print("rhs is " , rhs)
EXTRAS_REQUIRE_DEPS[x][OPSYS] try:
for x in rhs if rhs and any([ EXTRAS_REQUIRE_DEPS[x][OPSYS] for x in rhs if x in EXTRAS_REQUIRE_DEPS ]):
if x in EXTRAS_REQUIRE_DEPS #print("x is: " , x ) ### too late
]): rhs_cmd = ''.join([ CMD, ' ',
rhs_cmd = ''.join([ ' '.join([ ''. join([ xx for xx in EXTRAS_REQUIRE_DEPS[x][OPSYS] ])
CMD, for x in rhs
' ', if x in EXTRAS_REQUIRE_DEPS ]), ])
' '.join([ print( "Optional dependency `pip install .[{}]` would require `{}`" , " to be run as root".format(lhs, rhs_cmd))
''. join([ except KeyError: pass # all is satisfied - someone(TM) needs to do this properly...
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: 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:")