-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdev_cli.py
More file actions
executable file
·65 lines (56 loc) · 2.31 KB
/
Copy pathdev_cli.py
File metadata and controls
executable file
·65 lines (56 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env python3
"""Development CLI entry point that ensures local code is used."""
import os
import sys
import logging
# Configure root logger to show debug messages
logging.basicConfig(
level=logging.INFO,
format='%(message)s',
stream=sys.stdout
)
# Ensure local src is prioritized
src_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'src'))
sys.path.insert(0, src_path)
# Import all necessary modules explicitly from local source. This imports
# `model_checker` (not `src.model_checker`) because src_path above is anchored
# to this script's own directory and inserted at the front of sys.path, so the
# import resolves correctly regardless of the caller's current working
# directory. The previous `from src.model_checker...` form only worked when
# the process cwd happened to be `code/` (so `src` itself was importable).
try:
# Try to import the main function from local source
from model_checker.__main__ import main
except ImportError as e:
print(f"Error importing from local source: {e}")
print(f"Current sys.path: {sys.path}")
sys.exit(1)
if __name__ == "__main__":
# Check for isomorphism debug flag
if "--iso-debug" in sys.argv:
# Set logging level to debug for isomorphism checks
logging.getLogger("model_checker.builder.iterate").setLevel(logging.DEBUG)
logging.getLogger("model_checker.builder.graph_utils").setLevel(logging.DEBUG)
sys.argv.remove("--iso-debug")
print("Enabled isomorphism debugging")
# Get command line arguments
if len(sys.argv) > 1:
# Fix common command variations
# Fix the -load/-l argument to correctly handle load_theory flag
if "-load" in sys.argv:
load_index = sys.argv.index("-load")
sys.argv[load_index] = "-l"
# Handle variations like --load
if "--load" in sys.argv:
load_index = sys.argv.index("--load")
sys.argv[load_index] = "-l"
args = sys.argv[1:]
# Set sys.argv for the main function
sys.argv = [sys.argv[0]] + args
# Call the main function
main()
else:
# If no arguments provided, mimic the installed behavior
from model_checker.builder import BuildProject
builder = BuildProject()
builder.ask_generate()