From 99961f21e5f3d2f66302d957f981119da1950f59 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 12 Aug 2012 14:10:33 -0400 Subject: [PATCH] So long build.py, you've been replaced by a Makefile --- build.py | 125 ------------------------------------------------------- 1 file changed, 125 deletions(-) delete mode 100755 build.py diff --git a/build.py b/build.py deleted file mode 100755 index f22aae6..0000000 --- a/build.py +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/env python2.5 -# -# Armadillo File Manager -# Copyright (c) 2010-2012, Robert Sesek -# -# This program is free software: you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free Software -# Foundation, either version 3 of the License, or any later version. -# - -import optparse -import os -import re -import shutil -import string -import subprocess -import sys -import time - -ROOT = os.path.dirname(os.path.realpath(__file__)) -SRC_PATH = os.path.join(ROOT, 'src') -PROD_PATH = os.path.join(ROOT, 'frontend') -FE_PATH = os.path.join(ROOT, 'frontend') - -CLOSURE_COMPILER = os.path.join(ROOT, 'closure-compiler.jar') - -VERSION_FILE = os.path.join(FE_PATH, 'version.js.proto') - -SOURCES_FE = [ - 'jquery-1.7.1.js', - 'utils.js', - 'version.js', - 'tv_renamer.js', - 'path_control.js', - 'actor.js', - 'file.js', - 'main.js', -] -PRODUCT_NAME = 'armadillo' - -# The Golang version (hg id). -BACK_END_COMPILER_VERSION = '920e9d1ffd1f (release-branch.go1) go1/release' - -def _CompileBackEnd(): - args = [ 'go', 'build', '-v', '.' ] - print ' ' + ' ' .join(args) - handle = subprocess.Popen(args, stdout = sys.stdout, stderr = sys.stderr) - handle.wait() - -def _StampVersion(options): - print '=== Version Stamp ===' - if os.path.exists(VERSION_FILE): - gitcrement = subprocess.Popen([ 'gitcrement', 'next' ], stdout = subprocess.PIPE, cwd = ROOT) - gitcrement.wait() - build_stamp = gitcrement.stdout.read().strip() - time_stamp = str(int(time.time())) - - fd = open(VERSION_FILE, 'a+') - fd.seek(0) - lines = fd.readlines() - fd.seek(0) - fd.truncate() - for line in lines: - line = re.sub(r'(BUILD =) ([0-9\.]+)', r'\1 ' + build_stamp, line) - line = re.sub(r'(STAMP =) ([0-9]+)', r'\1 ' + time_stamp, line) - fd.write(line) - fd.close() - print ' BUILD ' + build_stamp + ' @ ' + time_stamp - if options.compile_fe: - mfiles = subprocess.Popen([ 'git', 'ls-files', '-m' ], stdout = subprocess.PIPE, cwd = ROOT) - mfiles.wait() - versioned_stamp_file = string.replace(VERSION_FILE, '.proto', '') - shutil.copy(VERSION_FILE, versioned_stamp_file) - print ' COPY version.js.proto -> version.js' - if not len(mfiles.stdout.readlines()): - subprocess.Popen([ 'git', 'commit', '--author=Armadillo Build Script ', - '-m', 'Stamp version.js @ ' + build_stamp + '.', versioned_stamp_file ], stdout = sys.stdout, - stderr = sys.stderr).wait() - -def _CompileFrontEnd(options): - # Version - _StampVersion(options) - - # Compile JS. - print '=== Compiling Front End ===' - outfile = os.path.join(PROD_PATH, PRODUCT_NAME + '.js') - if options.compile_fe: - fe_sources = map(lambda f: '--js=' + os.path.join(FE_PATH, f), SOURCES_FE) - args = [ 'java', '-jar', CLOSURE_COMPILER ] - args.extend(fe_sources) - args.extend(['--js_output_file', outfile, '--compilation_level', 'SIMPLE_OPTIMIZATIONS']) - print ' ' + ' '.join(args) - handle = subprocess.Popen(args, stdout = sys.stdout, stderr = sys.stderr) - handle.wait() - else: - fd = open(outfile, 'w+') - for fe_source in SOURCES_FE: - fd2 = open(os.path.join(FE_PATH, fe_source), 'r') - fd.write('// === ' + fe_source + '\n') - fd.write(fd2.read()) - fd2.close() - fd.close() - print ' DONE' - - -def Main(): - parser = optparse.OptionParser() - parser.add_option('-c', '--closure_fe', action="store_true", dest="compile_fe", - help="Run the Front End inputs through the Closure Compiler") - parser.add_option('-b', '--back-end', action="store_true", dest="backend_only", - help="Compiles only the back-end") - parser.add_option('-f', '--front-end', action="store_true", dest="frontend_only", - help="Compiles only the front-end") - (options, args) = parser.parse_args() - - print '=== Starting Build ===' - os.chdir(ROOT) - if not options.frontend_only: - _CompileBackEnd() - - if not options.backend_only: - _CompileFrontEnd(options) - -if __name__ == '__main__': - Main() -- 2.43.5