Debian Codegraph @

DisplayCAL/options.py

raw
1 """Parse commandline options.
2
3 Note that none of these are advertised, as they solely exist for testing and development
4 purposes.
5 """
6
7 import sys
8
9 # Use only ascii? (DON'T)
10 ASCII = "--ascii" in sys.argv[1:]
11
12 # Debug level (default: 0 = off). >= 1 prints debug messages
13 if "-d2" in sys.argv[1:] or "--debug=2" in sys.argv[1:]:
14 DEBUG = 2
15 elif (
16 "-d1" in sys.argv[1:]
17 or "--debug=1" in sys.argv[1:]
18 or "-d" in sys.argv[1:]
19 or "--debug" in sys.argv[1:]
20 ):
21 DEBUG = 1
22 else:
23 DEBUG = 0
24
25 # Debug localization
26 DEBUG_LOCALIZATION = "-dl" in sys.argv[1:] or "--debug-localization" in sys.argv[1:]
27
28 # Use alternate patch preview in the testchart editor?
29 TC_USE_ALTERNATE_PREVIEW = (
30 "-ap" in sys.argv[1:] or "--alternate-preview" in sys.argv[1:]
31 )
32
33 # Test some features even if they are not available normally
34 TEST = "-t" in sys.argv[1:] or "--test" in sys.argv[1:]
35
36 EECOLOR65 = "--ee65" in sys.argv[1:]
37
38 # Test sensor calibration
39 TEST_REQUIRE_SENSOR_CAL = (
40 "-s" in sys.argv[1:] or "--test_require_sensor_cal" in sys.argv[1:]
41 )
42
43 # Test update functionality
44 TEST_UPDATE = "-tu" in sys.argv[1:] or "--test-update" in sys.argv[1:]
45
46 # Test SSL connection using badssl.com
47 TEST_BADSSL = False
48 for arg in sys.argv[1:]:
49 if arg.startswith("--test-badssl="):
50 TEST_BADSSL = arg.split("=", 1)[-1]
51
52 # Always fail download
53 ALWAYS_FAIL_DOWNLOAD = "--always-fail-download" in sys.argv[1:]
54
55 # HDR input profile generation: Test input curve clipping
56 TEST_INPUT_CURVE_CLIPPING = "--test-input-curve-clipping" in sys.argv[1:]
57
58 # Enable experimental features
59 EXPERIMENTAL = "-x" in sys.argv[1:] or "--experimental" in sys.argv[1:]
60
61 # Verbosity level (default: 1). >= 1 prints some status information
62 if "-v4" in sys.argv[1:] or "--verbose=4" in sys.argv[1:]:
63 VERBOSE = 4
64 elif "-v3" in sys.argv[1:] or "--verbose=3" in sys.argv[1:]:
65 VERBOSE = 3
66 elif "-v2" in sys.argv[1:] or "--verbose=2" in sys.argv[1:]:
67 VERBOSE = 2
68 elif "-v0" in sys.argv[1:] or "--verbose=0" in sys.argv[1:]:
69 VERBOSE = 0 # Off
70 else:
71 VERBOSE = 1
72
73 # Use Colord GObject introspection interface (otherwise, use D-Bus)
74 USE_COLORD_GI = "--use-colord-gi" in sys.argv[1:]
75
76 # Skip initial instrument/port detection on startup
77 FORCE_SKIP_INITIAL_INSTRUMENT_DETECTION = (
78 "--force-skip-initial-instrument-detection" in sys.argv[1:]
79 )