globalvars.py: new GlobalConstants (gc), GlobalVars (gv) classes

- The attributes of GlobalConstants are non-configurable.  They’re constant
  for a given machine, user, executable and MMGen release.

- The attributes of GlobalVars, `stderr` and `stdout`, are used by the test
  suite to redirect msg() and friends to /dev/null.

- All the aforementioned attributes formerly belonged to GlobalConfig.
This commit is contained in:
The MMGen Project 2023-03-28 18:14:36 +00:00
commit c3ce1ab8e3
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
70 changed files with 309 additions and 282 deletions

View file

@ -19,7 +19,7 @@
import sys,os
import mmgen.opts as opts
from mmgen.globalvars import g
from mmgen.globalvars import gc
from mmgen.util import msg,die
def normalize_path(p):
@ -53,7 +53,7 @@ opts_data = {
cmd_args = opts.init(opts_data)
if g.platform == 'linux' and os.getenv('USER') != 'root':
if gc.platform == 'linux' and os.getenv('USER') != 'root':
die(1,'This program must be run as root')
if len(cmd_args):