Ejemplo n.º 1
0
def build_module(module, required):
    import os.path
    tools.mkdir_safe('product/modules/%s' % module)
    out = 'product/modules/%s/%s.o' % (module, module)
    srcs = []

    metafile = 'modules/%s/%s.meta' % (module, module)
    if os.path.exists(metafile):
        tools.copy_file('product/modules/%s/%s.meta' % (module, module),
                        metafile)
        srcs.append(metafile)
    meta = tools.load_meta(metafile)
    extra_objs = ''
    if 'objs' in meta:
        extra_objs = meta['objs']
    src = 'modules/%s/%s.rip' % (module, module)
    if tools.depends(out, module_deps + [src]):
        tools.pprint('MOD', src, out)
        args = [
            'product/ripe', conf["RFLAGS"], '-n', module, '-c', srcs, src,
            extra_objs, '-o', out
        ]
        # Required (default) packages have already been typed, and are
        # loaded by default.  Hence, they do not need to be typed.
        if required:
            args.append('--omit-typing')
        if conf["VERBOSITY"] > 1:
            args.append('-v')
        if required:
            tools.call(args)
        else:
            if not tools.try_call(args):
                failed_modules.append(module)
Ejemplo n.º 2
0
def cons_yacc(target, src, depends):
    tdepends = [src] + depends

    # Check timestamps
    if tools.depends(target, tdepends):
        tools.pprint("YAC", src, target)
        tools.call(['bison', src])
Ejemplo n.º 3
0
def cons_flex(target, src, depends):
    tdepends = [src] + depends

    # Check timestamps
    if tools.depends(target, tdepends):
        tools.pprint("LEX", src, target)
        tools.call(['flex', src])
Ejemplo n.º 4
0
 def openPath(self, _, path):  # Open path
     LOGGER.info("Opening '%s'", path)
     if pathExists(path):
         try:
             call(['xdg-open', path])
         except:
             LOGGER.error("Start of '%s' failed", path)
Ejemplo n.º 5
0
def build_module(module, required):
    import os.path
    tools.mkdir_safe('product/modules/%s' % module)
    out = 'product/modules/%s/%s.o' % (module, module)
    srcs = []

    metafile = 'modules/%s/%s.meta' % (module, module)
    if os.path.exists(metafile):
        tools.copy_file('product/modules/%s/%s.meta' % (module, module), metafile)
        srcs.append(metafile)
    meta = tools.load_meta(metafile)
    extra_objs = ''
    if 'objs' in meta:
        extra_objs = meta['objs']
    src = 'modules/%s/%s.rip' % (module, module)
    if tools.depends(out, module_deps + [src]):
        tools.pprint('MOD', src, out)
        args = ['product/ripe', conf["RFLAGS"], '-n', module,
                '-c', srcs, src, extra_objs, '-o', out]
        # Required (default) packages have already been typed, and are
        # loaded by default.  Hence, they do not need to be typed.
        if required:
          args.append('--omit-typing')
        if conf["VERBOSITY"] > 1:
            args.append('-v')
        if required:
            tools.call(args)
        else:
            if not tools.try_call(args):
                failed_modules.append(module)
Ejemplo n.º 6
0
def type_module(module):
    path = 'modules/%s/%s.rip' % (module, module)
    out = 'product/modules/%s/%s.typ' % (module, module)
    if tools.depends(out, type_deps + [path]):
        sys.stdout.write(tools.color_src + module + tools.color_reset + " ")
        tools.mkdir_safe('product/modules/%s' % module)
        tools.call(['product/ripe', '-t', path, '>', out])
    return out
Ejemplo n.º 7
0
def cons_obj(target, src, depends):
    tdepends = [src] + depends

    # Check timestamps
    if tools.depends(target, tdepends):
        # Build object
        tools.pprint('CC', src, target)
        tools.call([CC, CFLAGS, '-c', src, '-o', target])
Ejemplo n.º 8
0
def type_module(module):
    path = 'modules/%s/%s.rip' % (module, module)
    out = 'product/modules/%s/%s.typ' % (module, module)
    if tools.depends(out, type_deps + [path]):
        sys.stdout.write(tools.color_src + module + tools.color_reset + " ")
        tools.mkdir_safe('product/modules/%s' % module)
        tools.call(['product/ripe', '-t', path, '>', out])
    return out
Ejemplo n.º 9
0
def cons_module(src, dest, module, extra_CFLAGS=''):
    if tools.depends(dest, module_deps + [src]):
        tools.pprint('MOD', src, dest)
        args = ['product/ripe', '-n', module, '-c', src, '-o', dest,
                        '-f', '"%s"' % extra_CFLAGS]
        if tools.is_verbose():
            args.append('-v')
        tools.call(args)
Ejemplo n.º 10
0
    def error(self, errStr, cfgPath):
        """ Error handler GUI implementation """
        # it must handle two types of error cases:
        # - yandex-disk is not installed (errStr=='' in that case) - just show error message and return
        # - yandex-disk is not configured (errStr!='' in that case) - suggest to configure it and run ya-setup if needed
        if errStr == '':
            text1 = _('Yandex.Disk Indicator: daemon start failed')
            buttons = Gtk.ButtonsType.OK
            text2 = (_(
                'Yandex.Disk utility is not installed.\n' +
                'Visit www.yandex.ru, download and install Yandex.Disk daemon.'
            ))
        else:
            text1 = _('Yandex.Disk Indicator: daemon start failed')
            buttons = Gtk.ButtonsType.OK_CANCEL
            text2 = (_(
                'Yandex.Disk daemon failed to start because it is not' +
                ' configured properly\n\n' + errStr + '\n\n' +
                '  To configure it up: press OK button.\n  Press Cancel to exit.'
            ))
        dialog = Gtk.MessageDialog(None, 0, Gtk.MessageType.INFO, buttons,
                                   text1)
        dialog.format_secondary_text(text2)
        dialog.set_icon(APPLOGO)
        response = dialog.run()

        if errStr != '' and response == Gtk.ResponseType.OK:  # Launch Set-up utility
            LOGGER.debug('starting configuration utility')
            retCode = call([pathJoin(APPINSTPATH, 'ya-setup'), cfgPath])
        else:
            retCode = 1
        dialog.destroy()
        return retCode  # 0 when error is not critical or fixed (daemon has been configured via ya-setup)
Ejemplo n.º 11
0
    def run_setup(self, command, developer_mode=False):
        bin_path = self._bin_path
        url = self._url

        if command=='install' and developer_mode:
            command='develop'

        command = [join(bin_path, 'python'),
                   join(url,'setup.py'),
                   command]

        return call(command, self._logger, cwd=url)
Ejemplo n.º 12
0
def bootstrap(newripe, oldripe, depends):
    if tools.depends(newripe, [oldripe] + depends):
        tools.pprint('RIP', 'riperipe/*.rip', newripe)
        args = [conf["VALGRIND"], oldripe,
                   '-s', '-o', newripe, bootstrap_srcs]
        tools.call(args)
Ejemplo n.º 13
0
def link_objs(objs, output):
    # Link objects into the output program
    if tools.depends(output, objs):
        arr = tools.flatten([LD, '-r', objs, '-o', output])
        tools.pprint('LD', output)
        tools.call(arr)
Ejemplo n.º 14
0
 def run_setup(self, command):
     bin_path = self._bin_path
     url = self._url
     command = [ join(bin_path, 'python'), join(url,'setup.py'), command ]
     return call(command, self._logger, cwd=url)
Ejemplo n.º 15
0
ripe_hs = [ 'ripe/ripe.h' ]
ripe_srcs = [ 'ripe/cli.c', 'ripe/ripe.c' ]
ripe_objs = tools.cons_objs(ripe_srcs, ripe_hs + clib_hs + lang_hs)
tools.cons_bin('bin/ripeboot', ripe_objs + clib_objs + lang_objs, [])

if conf["DUMP_RTL"] == True:
    # Construct a list of RTL dumps
    objs = lang_objs
    dumps = []
    for obj in objs:
        obj = obj.replace('.o', '.c')
        dump = obj + '.144r.expand'
        if os.path.exists(dump):
            dumps.append(dump)
    tools.call(['cat'] + dumps + ['>', 'lang.dump'])

###############################################################################
# VM

func_gen_objs = tools.cons_objs(['vm/func-gen/func-gen.c'], [])
tools.cons_bin('bin/func-gen', func_gen_objs, [])
tools.cons_gen('bin/func-gen', 'vm/func-generated.c', 'c')
tools.cons_gen('bin/func-gen', 'vm/func-generated.h', 'h')

ops_gen_objs = tools.cons_objs(['vm/ops-gen/ops-gen.c'], [])
tools.cons_bin('bin/ops-gen', ops_gen_objs, [])
tools.cons_gen('bin/ops-gen', 'vm/ops-generated.c', 'c')
tools.cons_gen('bin/ops-gen', 'vm/ops-generated.h', 'h')

vm_hs = [ 'vm/vm.h', 'vm/value_inline.c', 'vm/ops-generated.h',
Ejemplo n.º 16
0
def cons_bin(target, objs, depends):
    tdepends = objs + depends
    if tools.depends(target, tdepends):
        tools.pprint('BIN', target)
        tools.call([CC, CFLAGS, LFLAGS, objs, '-o', target])
Ejemplo n.º 17
0
def cons_gen(gen_program, target, t):
    if tools.depends(target, [gen_program]):
        tools.pprint('GEN', gen_program, target)
        tools.call([gen_program, t, '>', target])
Ejemplo n.º 18
0
def bootstrap(newripe, oldripe, depends):
    if tools.depends(newripe, [oldripe] + depends):
        tools.pprint('RIP', 'riperipe/*.rip', newripe)
        args = [conf["VALGRIND"], oldripe, '-s', '-o', newripe, bootstrap_srcs]
        tools.call(args)
Ejemplo n.º 19
0
ripe_hs = ['ripe/ripe.h']
ripe_srcs = ['ripe/cli.c', 'ripe/ripe.c']
ripe_objs = tools.cons_objs(ripe_srcs, ripe_hs + clib_hs + lang_hs)
tools.cons_bin('bin/ripeboot', ripe_objs + clib_objs + lang_objs, [])

if conf["DUMP_RTL"] == True:
    # Construct a list of RTL dumps
    objs = lang_objs
    dumps = []
    for obj in objs:
        obj = obj.replace('.o', '.c')
        dump = obj + '.144r.expand'
        if os.path.exists(dump):
            dumps.append(dump)
    tools.call(['cat'] + dumps + ['>', 'lang.dump'])

###############################################################################
# VM

func_gen_objs = tools.cons_objs(['vm/func-gen/func-gen.c'], [])
tools.cons_bin('bin/func-gen', func_gen_objs, [])
tools.cons_gen('bin/func-gen', 'vm/func-generated.c', 'c')
tools.cons_gen('bin/func-gen', 'vm/func-generated.h', 'h')

ops_gen_objs = tools.cons_objs(['vm/ops-gen/ops-gen.c'], [])
tools.cons_bin('bin/ops-gen', ops_gen_objs, [])
tools.cons_gen('bin/ops-gen', 'vm/ops-generated.c', 'c')
tools.cons_gen('bin/ops-gen', 'vm/ops-generated.h', 'h')

vm_hs = [
Ejemplo n.º 20
0
 def run_setup(self, command):
     bin_path = self._bin_path
     url = self._url
     command = [join(bin_path, 'python'), join(url, 'setup.py'), command]
     return call(command, self._logger, cwd=url)