1 | import platform, sys |
---|
2 | |
---|
3 | |
---|
4 | def init_colors(args): |
---|
5 | global ANSI_SETGREEN, ANSI_SETRED, ANSI_RESET |
---|
6 | if args.nocolor: |
---|
7 | ANSI_SETGREEN = ANSI_SETRED = ANSI_RESET = '' |
---|
8 | else: |
---|
9 | ANSI_SETGREEN = '\x1b[32m' + '\x1b[1m' # after '+' there is brightness control (making brighter) |
---|
10 | ANSI_SETRED = '\x1b[31m' + '\x1b[1m' |
---|
11 | ANSI_RESET = '\x1b[39m' + '\x1b[0m' # after '+' the brightness is reset |
---|
12 | if platform.system() == "Windows": |
---|
13 | try: |
---|
14 | from colorama import init, Fore, Style # Fore and Style are here just to get ansi codes to control color and brightness |
---|
15 | except ImportError: |
---|
16 | print("The colorama module not available - there will be no ansi stdout colors") |
---|
17 | ANSI_SETGREEN = ANSI_SETRED = ANSI_RESET = '' |
---|
18 | else: |
---|
19 | init() # from colorama |
---|
20 | # print repr(Fore.GREEN) # print sample ansi codes (just for debugging/curiosity) |
---|
21 | # print repr(Fore.RED) |
---|
22 | # print repr(Fore.RESET) |
---|
23 | # print repr(Style.BRIGHT) |
---|
24 | |
---|
25 | |
---|
26 | def stripEOL(s): |
---|
27 | for char in '\n\r': |
---|
28 | if s[-1:len(s)] == char: |
---|
29 | s = s[:-1] |
---|
30 | return s |
---|
31 | |
---|
32 | |
---|
33 | ################################################################ main ################################################################ |
---|
34 | |
---|
35 | # no longer assuming any specific directory layout, use -tp/-wp/-fp to configure as needed |
---|
36 | THISDIR = "." # -tp |
---|
37 | EXEDIR = "." # -wp |
---|
38 | FILESDIR = "." # -fp |
---|
39 | |
---|
40 | # special ways of comparison, to be used in 'out' lines |
---|
41 | SPEC_REGEXP = "*REGEXP*:" |
---|
42 | SPEC_SKIPTO = "*SKIPTO*:" # skips any number of lines until a matching line is found |
---|
43 | SPEC_INSERTPLATFORMDEPENDENTFILE = "*INSERTPLATFORMDEPENDENTFILE*:" # loads into this location a file from disk, appending the platform name to the file name. Convention: we either use a single non-specialized file (i.e. results are identical everywhere) or we don't prepare such a single file, but we prepare all specialized files with separate results for each platform |
---|
44 | |
---|
45 | WIN_SLASH_SENSITIVE = False |
---|
46 | |
---|
47 | EXENETMODE = ["-N"] |
---|
48 | ini = "" |
---|
49 | EXEVALGRINDMODE = ["bash", "vg", "--leak-check=full"] |
---|
50 | |
---|
51 | # data becomes a home dir so that tester can find what it looks for. |
---|
52 | # As a resource dir we set 'emptydata' to make frams use only home, but still use splitfilesys. |
---|
53 | # You could also set -Ddata to activate the mode with no splitfilesys. |
---|
54 | EXENAMES = {"default": ["frams.exe", "-ddata", "-Demptydata", "-Q", "-s"], |
---|
55 | "theater": ["theater.exe", "-ddata", "-Demptydata", "-Q", "st"]} |
---|
56 | |
---|
57 | EXERULES = [] |
---|
58 | |
---|
59 | PLATFORM = sys.platform |
---|