Exemplo n.º 1
0
def build(out, use_git):
    version = None
    if use_git:
        print(run('git pull'))
        version = run('git log -1 --format="%ci%n%H"')

    build_version = None
    build_version_path = os.path.join(out, 'version.txt')
    try:
        with open(build_version_path) as f:
            build_version = f.read()
    except:
        pass

    if (not build_version is None) and build_version == version:
        print("current html is up to date, do nothing")
        return

    if not os.path.exists(out):
        os.mkdir(out)

    link('oc.js', os.path.join(out, 'oc.js'), 'src', version)
    copy('browser/oberonjs.html', out)
    copytree('browser/codemirror', os.path.join(out, 'codemirror'))

    if version is None:
        if os.path.exists(build_version_path):
            os.remove(build_version_path)
    else:
        with open(build_version_path, 'w') as f:
            f.write(version)
Exemplo n.º 2
0
def build(out, use_git):
    version = None
    if use_git:
        print(run('git pull'))
        version = run('git log -1 --format="%ci%n%H"')

    build_version = None
    build_version_path = os.path.join(out, 'version.txt')
    try:
        with open(build_version_path) as f:
            build_version = f.read()
    except:
        pass

    if (not build_version is None) and build_version == version:
        print("current html is up to date, do nothing")
        return

    if not os.path.exists(out):
        os.mkdir(out)

    link('oc.js', os.path.join(out, 'oc.js'), 'src', version)
    copy('browser/oberonjs.html', out)
    copytree('browser/codemirror', os.path.join(out, 'codemirror'))
    
    if version is None:
        if os.path.exists(build_version_path):
            os.remove(build_version_path)
    else:
        with open(build_version_path, 'w') as f:
            f.write(version)
Exemplo n.º 3
0
Arquivo: build.py Projeto: z505/QompJS
def build_html(options):
    version = None
    if options.set_version:
        print(run(['git', 'pull']))
        version = run(['git', 'log', '-1', '--format="%ci%n%H"'])

    out = options.out
    build_version = None
    build_version_path = os.path.join(out, 'version.txt')
    try:
        with open(build_version_path) as f:
            build_version = f.read()
    except:
        pass

    if (not build_version is None) and build_version == version:
        print("current html is up to date, do nothing")
        return

    if not options.do_not_unpack_compiled:
        print('unpacking compiled js to %s...' % package.root)
        package.unpack()

    if not os.path.exists(out):
        os.mkdir(out)

    link(['oc.js', 'oberon/oberon_grammar.js', 'eberon/eberon_grammar.js', 'test_unit.js'],
         os.path.join(out, 'oc.js'),
         ['src', 'bin', 'test'],
         version)
    copy('browser/oberonjs.html', out)
    for d in ['codemirror', 'jslibs']:
        copytree(os.path.join('browser', d), os.path.join(out, d))
    
    if version is None:
        if os.path.exists(build_version_path):
            os.remove(build_version_path)
    else:
        with open(build_version_path, 'w') as f:
            f.write(version)
Exemplo n.º 4
0
Arquivo: build.py Projeto: z505/QompJS
def build_html(options):
    version = None
    if options.set_version:
        print(run(['git', 'pull']))
        version = run(['git', 'log', '-1', '--format="%ci%n%H"'])

    out = options.out
    build_version = None
    build_version_path = os.path.join(out, 'version.txt')
    try:
        with open(build_version_path) as f:
            build_version = f.read()
    except:
        pass

    if (not build_version is None) and build_version == version:
        print("current html is up to date, do nothing")
        return

    if not options.do_not_unpack_compiled:
        print('unpacking compiled js to %s...' % package.root)
        package.unpack()

    if not os.path.exists(out):
        os.mkdir(out)

    link([
        'oc.js', 'oberon/oberon_grammar.js', 'eberon/eberon_grammar.js',
        'test_unit.js'
    ], os.path.join(out, 'oc.js'), ['src', 'bin', 'test'], version)
    copy('browser/oberonjs.html', out)
    for d in ['codemirror', 'jslibs']:
        copytree(os.path.join('browser', d), os.path.join(out, d))

    if version is None:
        if os.path.exists(build_version_path):
            os.remove(build_version_path)
    else:
        with open(build_version_path, 'w') as f:
            f.write(version)