Skip to content
Snippets Groups Projects
Commit 48e84ff6 authored by Michele Alberti's avatar Michele Alberti Committed by Aymeric Varasse
Browse files

[bin] Better python script for faking --version option.

Not only it searches for the python module given as first parameter, but it also
tries to import it for approximate whether its execution will fail or not (for
example, due to a missing dependency).
parent 5271c953
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,7 @@
if [ "$1" = "--version" ]; then
SCRIPT_DIR=$( dirname -- "$0"; )
$SCRIPT_DIR/findmodule.py "complete_verifier.abcrown" "dummy-version"
$SCRIPT_DIR/dummyversion.py "complete_verifier.abcrown" "dummy-version"
else
python3 -m complete_verifier.abcrown "$@"
OMP_NUM_THREADS=1 python3 -m complete_verifier.abcrown "$@"
fi
......@@ -23,14 +23,24 @@
import sys
import importlib
from importlib import import_module
module_name = str(sys.argv[1])
output = str(sys.argv[2])
dummy_version = str(sys.argv[2])
spec = importlib.util.find_spec(module_name)
if spec is not None:
print(output)
exit(0)
else:
if spec is None:
# [module_name] cannot be found: most likely, the PYTHONPATH has not been
# correctly set up.
exit(1)
# [module_name] has been found. However, this is not sufficient to conclude that
# its interpretation/execution will not fail, e.g., due to unmet dependencies.
try:
import_module(module_name)
except ModuleNotFoundError as error:
exit(1)
print(dummy_version)
exit(0)
\ No newline at end of file
......@@ -2,6 +2,6 @@
(package caisar)
(section bin)
(files
(findmodule.py as findmodule.py)
(dummyversion.py as dummyversion.py)
(nnenum.sh as nnenum.sh)
(abcrown.sh as abcrown.sh)))
......@@ -23,7 +23,7 @@
if [ "$1" = "--version" ]; then
SCRIPT_DIR=$( dirname -- "$0"; )
$SCRIPT_DIR/findmodule.py "nnenum" "dummy-version"
$SCRIPT_DIR/dummyversion.py "nnenum.nnenum" "dummy-version"
else
OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python3 -m nnenum.nnenum "$@"
fi
......@@ -108,7 +108,7 @@ command = "%e --device cpu --onnx_path %{nnet-onnx} --vnnlib_path %f --timeout %
driver = "%{config}/drivers/abcrown.drv"
use_at_auto_level = 1
[ATP abcrown]
[ATP abcrown-acas]
name = "alpha-beta-CROWN"
alternative = "ACAS"
exec = "abcrown.sh"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment