view third_party/emsdk/scripts/get_emscripten_revision_info.py @ 279:b3b547563ec7

Add Google connector service and agent wiki Implement the C/Seobeo Google Drive and Gmail connector with encrypted OAuth storage, Zenbu authentication, browser testing, AI tool discovery, chunked HTTP decoding, and Bazel coverage. Consolidate repository guidance into progressive wiki documentation and enforce arena-first allocation for new first-party C code. Co-authored-by: Copilot <[email protected]> Copilot-Session: 84c338fd-0939-4bb3-b7f3-1062eb213e5d
author MrJuneJune <me@mrjunejune.com>
date Mon, 17 Aug 2026 22:22:36 -0700
parents 8d17f6e6e290
children
line wrap: on
line source

#!/usr/bin/env python3

import json
import os
import subprocess
import sys

EMSCRIPTEN_RELEASES_GIT = 'https://chromium.googlesource.com/emscripten-releases'
TAGFILE = 'emscripten-releases-tags.json'


def get_latest_hash(tagfile):
    with open(tagfile) as f:
        versions = json.load(f)
        latest = versions['aliases']['latest']
        return versions['releases'][latest]


def get_latest_emscripten(tagfile):
    latest = get_latest_hash(tagfile)
    if not os.path.isdir('emscripten-releases'):
        subprocess.run(['git', 'clone', EMSCRIPTEN_RELEASES_GIT, '--depth',
                        '100'], check=True)
    # This will fail if the 'latest' revision is not within the most recent
    # 100 commits; but that shouldn't happen because this script is intended
    # to be run right after a release is added.
    info = subprocess.run(['emscripten-releases/src/release-info.py',
                           'emscripten-releases', latest],
                          stdout=subprocess.PIPE, check=True, text=True).stdout
    for line in info.split('\n'):
        tokens = line.split()
        if len(tokens) and tokens[0] == 'emscripten':
            return tokens[2]


if __name__ == '__main__':
    emscripten_hash = get_latest_emscripten(TAGFILE)
    print('Emscripten revision ' + emscripten_hash)
    if 'GITHUB_ENV' in os.environ:
        with open(os.environ['GITHUB_ENV'], 'a') as f:
            f.write(f'EMSCRIPTEN_HASH={emscripten_hash}')
        sys.exit(0)
    print('Not a GitHub Action')
    sys.exit(1)