Changes in tools/ew.py [01552e3:dabaa83] in mainline


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/ew.py

    r01552e3 rdabaa83  
    3333"""
    3434
    35 import inspect
    3635import os
     36import sys
     37import subprocess
     38import autotool
    3739import platform
    38 import re
    39 import subprocess
    40 import sys
    4140import thread
    4241import time
    4342
    4443overrides = {}
    45 
    46 CONFIG = 'Makefile.config'
    47 
    48 TOOLS_DIR = os.path.dirname(inspect.getabsfile(inspect.currentframe()))
    49 
    50 def read_config():
    51         "Read HelenOS build configuration"
    52 
    53         inf = open(CONFIG, 'r')
    54         config = {}
    55 
    56         for line in inf:
    57                 res = re.match(r'^(?:#!# )?([^#]\w*)\s*=\s*(.*?)\s*$', line)
    58                 if (res):
    59                         config[res.group(1)] = res.group(2)
    60 
    61         inf.close()
    62         return config
    6344
    6445def is_override(str):
     
    7657
    7758def termemu_detect():
    78         emus = ['gnome-terminal', 'xfce4-terminal', 'xterm']
    79         for termemu in emus:
     59        for termemu in ['xfce4-terminal', 'xterm']:
    8060                try:
    8161                        subprocess.check_output('which ' + termemu, shell = True)
     
    8464                        pass
    8565
    86         print('Could not find any of the terminal emulators %s.'%(emus))
    87         sys.exit(1)
    88 
    8966def run_in_console(cmd, title):
    90         temu = termemu_detect()
    91         if temu == 'gnome-terminal':
    92                 cmdline = temu + ' -- ' + cmd
    93         else:
    94                 ecmd = cmd.replace('"', '\\"')
    95                 cmdline = temu + ' -T ' + '"' + title + '"' + ' -e "' + ecmd + '"'
    96 
     67        ecmd = cmd.replace('"', '\\"')
     68        cmdline = termemu_detect() + ' -T ' + '"' + title + '"' + ' -e "' + ecmd + '"'
    9769        print(cmdline)
    9870        if not is_override('dryrun'):
     
    183155def hdisk_mk():
    184156        if not os.path.exists('hdisk.img'):
    185                 subprocess.call(TOOLS_DIR + '/mkfat.py 1048576 dist/data hdisk.img', shell = True)
     157                subprocess.call('tools/mkfat.py 1048576 uspace/dist/data hdisk.img', shell = True)
    186158
    187159def qemu_bd_options():
     
    317289
    318290def ski_run(platform, machine, processor):
    319         run_in_console('ski -i ' + TOOLS_DIR + '/conf/ski.conf', 'HelenOS/ia64 on ski')
     291        run_in_console('ski -i tools/conf/ski.conf', 'HelenOS/ia64 on ski')
    320292
    321293def msim_run(platform, machine, processor):
    322294        hdisk_mk()
    323         run_in_console('msim -c ' + TOOLS_DIR + '/conf/msim.conf', 'HelenOS/mips32 on msim')
     295        run_in_console('msim -c tools/conf/msim.conf', 'HelenOS/mips32 on msim')
    324296
    325297def spike_run(platform, machine, processor):
     
    514486                        exit()
    515487
    516         config = read_config()
     488        config = {}
     489        autotool.read_config(autotool.CONFIG, config)
    517490
    518491        if 'PLATFORM' in config.keys():
Note: See TracChangeset for help on using the changeset viewer.