Esempio n. 1
0
def build_opmuse():
    config = ConfigParser()
    config.read('setup.cfg')

    if not os.path.exists('build'):
        os.mkdir('build')

    copy('config/opmuse.dist.ini', 'build/opmuse.ini')

    for line in fileinput.input("opmuse/__init__.py", inplace=True):
        if re.match(r'^__version__\s*=', line):
            sys.stdout.write("__version__ = '%s'\n" % git_version)
        else:
            sys.stdout.write(line)

    for line in fileinput.input("build/opmuse.ini", inplace=True):
        if re.match(r'[#]*lastfm\.key\s*=', line):
            sys.stdout.write("lastfm.key = '%s'\n" % config['global']['lastfm.key'])
        elif re.match(r'[#]*lastfm\.secret\s*=', line):
            sys.stdout.write("lastfm.secret = '%s'\n" % config['global']['lastfm.secret'])
        else:
            sys.stdout.write(line)

    less_compiler.compile(path='build/main.css')
    js_compiler.compile(path='build/javascript/scripts')

    shutil.copytree('public_static/lib', 'build/javascript/lib')

    subprocess.check_call(['node', 'node_modules/requirejs/bin/r.js', '-o', 'scripts/build-requirejs.js'])

    if not os.path.exists('build/debian-dbconfig-install'):
        os.mkdir('build/debian-dbconfig-install')

    copy('scripts/debian-dbconfig-install-mysql', 'build/debian-dbconfig-install/mysql')

    if not os.path.exists('build/debian-dbconfig-upgrade-mysql'):
        os.mkdir('build/debian-dbconfig-upgrade-mysql')

    copy('scripts/debian-dbconfig-upgrade-mysql', 'build/debian-dbconfig-upgrade-mysql/all')
Esempio n. 2
0
def command_js():
    from opmuse.compilers import js_compiler
    js_compiler.compile()