Пример #1
0
def main(argv):
    if len(argv) != 4:
        return USAGE_STR.format(argv[0])

    apprtc_dir = os.path.abspath(argv[1])
    go_root_dir = os.path.abspath(argv[2])
    golang_workspace = os.path.abspath(argv[3])

    utils.RemoveDirectory(golang_workspace)

    golang_workspace_src = os.path.join(golang_workspace, 'src')

    collider_dir = os.path.join(apprtc_dir, 'collider')
    shutil.copytree(collider_dir, golang_workspace_src)

    golang_binary = 'go%s' % ('.exe' if utils.GetPlatform() == 'win' else '')
    golang_path = os.path.join(go_root_dir, 'bin', golang_binary)

    golang_env = os.environ.copy()
    golang_env['GOROOT'] = go_root_dir
    golang_env['GOPATH'] = golang_workspace
    collider_exec = os.path.join(golang_workspace, 'collidermain')
    subprocess.check_call(
        [golang_path, 'build', '-o', collider_exec, 'collidermain'],
        env=golang_env)
Пример #2
0
def main(argv):
    if len(argv) != 5:
        return USAGE_STR.format(argv[0])

    apprtc_dir = argv[1]
    go_root_dir = argv[2]
    mercurial_dir = argv[3]
    golang_workspace = argv[4]

    utils.RemoveDirectory(golang_workspace)

    golang_workspace_src = os.path.join(golang_workspace, 'src')

    collider_dir = os.path.join(apprtc_dir, 'collider')
    shutil.copytree(collider_dir,
                    golang_workspace_src,
                    ignore=shutil.ignore_patterns('.svn', '.git'))

    golang_binary = 'go%s' % ('.exe' if utils.GetPlatform() == 'win' else '')
    golang_path = os.path.join(go_root_dir, 'bin', golang_binary)

    golang_env = os.environ.copy()
    golang_env['GOROOT'] = go_root_dir
    golang_env['GOPATH'] = os.path.abspath(golang_workspace)
    golang_env['PATH'] += os.pathsep + mercurial_dir
    subprocess.check_call([golang_path, 'get', 'collidermain'], env=golang_env)
    collider_exec = os.path.join(golang_workspace, 'collidermain')
    subprocess.check_call(
        [golang_path, 'build', '-o', collider_exec, 'collidermain'],
        env=golang_env)
def main(argv):
    if len(argv) != 2:
        return 'Usage: %s <mercurial_dir>' % argv[0]

    mercurial_dir = argv[1]
    if not os.path.exists(mercurial_dir):
        return 'Expected mercurial at {}.'.format(mercurial_dir)

    os.chdir(mercurial_dir)

    if utils.GetPlatform() == 'win':
        subprocess.check_call([
            'python', 'setup.py', '--pure', 'build_py', '-c', '-d', '.',
            'build_ext', '-i', 'build_mo', '--force'
        ])
        with open('hg.bat', 'w') as put_hg_in_path:
            # Write a hg.bat since the go toolchain expects to find something called
            # 'hg' in the path, but Windows only recognizes executables ending with
            # an extension in PATHEXT. Writing hg.bat effectively makes 'hg' callable
            # if the mercurial folder is in PATH.
            mercurial_path = os.path.abspath('hg')
            put_hg_in_path.write('python %s %%*' % mercurial_path)
    else:
        subprocess.check_call(['make', 'local'])
Пример #4
0
def _GetGoArchivePathForPlatform():
    archive_extension = 'zip' if utils.GetPlatform() == 'win' else 'tar.gz'
    return os.path.join(utils.GetPlatform(), 'go.%s' % archive_extension)