source: tester/globals.py @ 1314

Last change on this file since 1314 was 806, checked in by Maciej Komosinski, 6 years ago

Cosmetic

  • Property svn:eol-style set to native
File size: 2.3 KB
Line 
1import platform, sys
2
3
4def 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
26def 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
36THISDIR = "."  # -tp
37EXEDIR = "."  # -wp
38FILESDIR = "."  # -fp
39
40# special ways of comparison, to be used in 'out' lines
41SPEC_REGEXP = "*REGEXP*:"
42SPEC_SKIPTO = "*SKIPTO*:"  # skips any number of lines until a matching line is found
43SPEC_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
45WIN_SLASH_SENSITIVE = False
46
47EXENETMODE = ["-N"]
48ini = ""
49EXEVALGRINDMODE = ["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.
54EXENAMES = {"default": ["frams.exe", "-ddata", "-Demptydata", "-Q", "-s"],
55                        "theater": ["theater.exe", "-ddata", "-Demptydata", "-Q", "st"]}
56
57EXERULES = []
58
59PLATFORM = sys.platform
Note: See TracBrowser for help on using the repository browser.