Python: Make ModelUsage test language agnostic

This commit is contained in:
Rasmus Wriedt Larsen
2020-02-14 17:50:46 +01:00
parent 87eff7f062
commit 0509228296
2 changed files with 11 additions and 8 deletions

View File

@@ -2,11 +2,15 @@ import python
from ModuleValue mv, string usage
where
mv.isUsedAsModule() and usage = "isUsedAsModule"
or
mv.isUsedAsScript() and usage = "isUsedAsScript"
or
not mv.isUsedAsModule() and
not mv.isUsedAsScript() and
usage = "<UNKNOWN>"
// builtin module has different name in Python 2 and 3
not mv = Module::builtinModule() and
(
mv.isUsedAsModule() and usage = "isUsedAsModule"
or
mv.isUsedAsScript() and usage = "isUsedAsScript"
or
not mv.isUsedAsModule() and
not mv.isUsedAsScript() and
usage = "<UNKNOWN>"
)
select mv, usage