def copy_xul_runtime(dir1, dir2):
    t0 = time.time()
    # Get extension
    ext = '.exe' if sys.platform.startswith('win') else ''
    # On Rasberry Pi, the xul runtime is in a (linked) subdir
    if op.isdir(op.join(dir1, 'xulrunner')):
        dir1 = op.join(dir1, 'xulrunner')
    # Clear
    if op.isdir(dir2):
        shutil.rmtree(dir2)
    os.mkdir(dir2)
    try:
        # Copy all files except dirs
        for fname in os.listdir(dir1):
            filename1 = op.join(dir1, fname)
            filename2 = op.join(dir2, fname)
            if op.isfile(filename1):
                shutil.copy2(filename1, filename2)
        # Copy firefox exe -> xulrunner
        for exe_name in ('firefox', 'iceweasel', 'xulrunner', 'firefox'):
            exe = op.join(dir1, exe_name + ext)
            if op.isfile(exe):
                break
        shutil.copy2(exe, op.join(dir2, 'xulrunner' + ext))
        logging.info('Copied firefox (in %1.2f s)' % (time.time()-t0))
    except Exception:
        # Clean up
        shutil.rmtree(dir2)
        raise
Returns a dictionary of navigators representing embedded
dataset/ETHPy150Open zoofIO/flexx/flexx/webruntime/xul.py/copy_xul_runtime--crossover with--dataset/ETHPy150Open deontologician/restnavigator/restnavigator/halnav.py/HALNavigatorBase.embedded