Exemplo n.º 1
0
    def test_check_output(self):

        cmd = [sys.executable, os.path.join(script_dir, 'timeout.py')]

        with self.assertRaises(process.TimeoutExpired) as exc:
            process.check_output(*cmd, timeout=0.1, stderr=process.DEVNULL)

        _ = str(exc.exception)  # just test for serialization exceptions

        cmd = [sys.executable, os.path.join(script_dir, 'throw.py')]

        with self.assertRaises(process.CalledProcessException) as exc:
            process.check_output(cmd, stderr=process.DEVNULL)

        _ = str(exc.exception)  # just test for serialization exceptions

        # Check pake propagates the exception correctly

        pake.de_init(clear_conf=False)

        pk = pake.init()

        @pk.task
        def dummy(ctx):
            process.check_output(cmd, stderr=process.DEVNULL)

        with self.assertRaises(pake.TaskException) as exc:
            pk.run(tasks=dummy)

        self.assertEqual(type(exc.exception.exception), process.CalledProcessException)
Exemplo n.º 2
0
def libasm_io_defines(ctx):
    abi = process.check_output('bash', 'platform.sh', 'abi').decode().strip()
    with open(ctx.outputs[0], 'w+') as inc_file:
        print('%define _LIBASM_IO_OBJFMT_{t}_'.format(t=obj_format_upper),
              file=inc_file)
        print('%define _LIBASM_IO_ABI_{t}_'.format(t=abi), file=inc_file)
        print('%define _LIBASM_IO_PLATFORM_TYPE_{t}_'.format(t=platform_type),
              file=inc_file)
Exemplo n.º 3
0
def get_windows_interactive_switch(have_winpty):
    have_uname = shutil.which('uname') != None

    if have_uname:
        uname = process.check_output('uname', '-s').decode()
        if uname.startswith('MINGW64') or uname.startswith('CYGWIN'):
            return '-ti' if have_winpty else '-i'

    return '-ti'
Exemplo n.º 4
0
 def dummy(ctx):
     process.check_output(cmd, stderr=process.DEVNULL)
Exemplo n.º 5
0
pk = pake.init()

force_fpic = pk.get_define('FPIC', False)

compiler = pk.get_define('CC', 'cc')
assembler = pk.get_define('AS', 'nasm')

obj_dir = 'obj'
src_dir = 'src'
bin_dir = 'bin'
inc_dir = 'include'

lib_name = 'libasm_io.a'

platform_type = process.check_output('bash', './platform.sh',
                                     'platform_type').decode().strip()

if force_fpic:
    libc_pic = 'pic'
else:
    libc_pic = process.check_output('bash', './platform.sh',
                                    'libc_pic').decode().strip()

c_symbol_underscores = 'plain'

obj_ext = '.o'
exe_ext = ''

if platform_type == 'NIX':
    obj_format = 'elf64'
    assembler = 'nasm'