def install(): fetch("http://ftp.gnome.org/pub/gnome/sources/json-glib/0.16/json-glib-%(json-glib)s.tar.xz") extract("json-glib-%(json-glib)s.tar.xz") configure( "json-glib-%(json-glib)s", ["--prefix=%s" % env.prefix, "--disable-gcov", "--disable-introspection", "CC=clang"] ) make("json-glib-%(json-glib)s") make("json-glib-%(json-glib)s", "install")
def _run(self, fmt): """ Run make, sending increments, and eventually change status to done. """ make_settings = ['-C', self.directory, 'dir_chmod=777', '-j', str(Config.processes), "python=%s" % Config.python_interpreter] if fmt == 'vrt' or fmt == 'cwb': make_settings = [fmt] + make_settings self.out_file = os.path.join(self.annotations_dir, 'text.vrt') else: make_settings = ['export'] + make_settings self.out_file = os.path.join(self.export_dir, 'text.xml') # Do a dry run to get the number of invocations that will be made stdout, _ = make(make_settings + ['--dry-run']).communicate("") steps = stdout.count(Config.python_interpreter) # Start make for real. First set up some environment variables os.environ['SB_MODELS'] = Config.sb_models # No remote installations allowed os.environ['remote_cwb_datadir']="null" os.environ['remote_cwb_registry']="null" os.environ['remote_host']="null" # Now, make! self.make_process = make(make_settings) self.change_status(Status.Running) # Process the output from make self.change_step(new_cmd="", new_step=0, new_steps=steps + 1) step = 0 for line in iter(self.make_process.stdout.readline, ''): self.make_out.append(line) if Config.python_interpreter in line: step += 1; argstring = line.split(Config.python_interpreter)[1] arguments = argstring.lstrip().split() command = " ".join(arguments[1:3]) if "--" in arguments[3] else arguments[1] self.change_step(new_step=step, new_cmd=command) self.change_step(new_cmd="", new_step=step+1) # Send warnings try: with open(self.warnings_log_file, "r") as f: self.warnings = f.read().rstrip() except IOError: self.warnings = None # The corpus should now be in self.out_file # Its contents is not stored because of memory reasons # assert os.path.isfile(self.out_file) self.change_status(Status.Done)
def install(): fetch_git('https://github.com/rafaelmartins/bluster.git', 'bluster') autogen('bluster') configure('bluster', ['--prefix=%s' % env.prefix, 'PKG_CONFIG_PATH=%s/lib/pkgconfig' % env.prefix, 'PATH=%s/bin:$PATH' % env.prefix, 'LDFLAGS="-Wl,--rpath -Wl,%s/lib -L%s/lib"' % (env.prefix, env.prefix), 'CFLAGS="-I%s/include"' % env.prefix, 'CC=clang']) make('bluster') make('bluster', 'install')
def install(): fetch('http://www.pell.portland.or.us/~orc/Code/discount/discount-%(discount)s.tar.bz2') extract('discount-%(discount)s.tar.bz2') configure('discount-%(discount)s', ['--prefix=%s' % env.prefix, '--libdir=%s/lib' % env.prefix, '--mandir=%s/man' % env.prefix, '--shared', '--enable-all-features'], 'configure.sh') run('sed -i .bkp -e "/ldconfig/d" %s/%s/librarian.sh' % (env.build, 'discount-%(discount)s' % env.versions)) make('discount-%(discount)s') make('discount-%(discount)s', 'install')
def install(): fetch("http://www.fastcgi.com/dist/fcgi-%(fcgi)s.tar.gz") extract("fcgi-%(fcgi)s.tar.gz") configure("fcgi-%(fcgi)s", ["--prefix=%s" % env.prefix]) make("fcgi-%(fcgi)s") make("fcgi-%(fcgi)s", "install")
#! /usr/bin/env python # -*- coding: utf-8 -*- from utils import make while True: s=make(raw_input(">>>").decode("utf-8")) if s.sentiments > 0.6: print "可能是褒义" else: print "可能是贬义"
import utils utils.make() utils.test() utils.print_all()
def install(): fetch('http://piumarta.com/software/peg/peg-%(peg)s.tar.gz') extract('peg-%(peg)s.tar.gz') make('peg-%(peg)s', 'CC=clang') make('peg-%(peg)s', 'PREFIX=%s install' % env.prefix)
def _run(self, fmt): """ Run make, sending increments, and eventually change status to done. """ def send_warnings(): try: with open(self.warnings_log_file, "r") as f: self.warnings = self.fix_warnings(f.read().rstrip()) except IOError: self.warnings = None make_settings = ['-C', self.directory, 'dir_chmod=777', '-j', str(Config.processes), "python=%s" % Config.python_interpreter] # First set up some environment variables os.environ['SPARV_MODELS'] = Config.sparv_models os.environ['SPARV_MAKEFILES'] = Config.sparv_makefiles # For initial parsing make_init = ['@TEXT'] + make_settings # For file upload if self.files: make_settings = ['export'] + make_settings self.out_files = [] self.textfiles = [] for filename, _text in self.files: self.out_files.append(os.path.join(self.export_dir, filename + '.xml')) self.textfiles.append(os.path.join(self.annotations_dir, filename + '.@TEXT')) # Try to parse files first stdout, stderr = make(make_init).communicate("") self.change_status(Status.Parsing) # Send warnings for out_file in self.textfiles: if not os.path.exists(out_file): send_warnings() self.change_status(Status.ParseError) log.error(ERROR_MSG["parsing_error"]) return else: # Try to parse file first self.textfile = os.path.join(self.annotations_dir, self.filename + '.@TEXT') stdout, stderr = make(make_init).communicate("") self.change_status(Status.Parsing) if stderr: send_warnings() self.change_status(Status.Error) self.stderr = stderr.rstrip().decode("UTF-8") log.error(ERROR_MSG["make_error"]) return # Send warnings if not os.path.exists(self.textfile): send_warnings() self.change_status(Status.ParseError) log.error(ERROR_MSG["parsing_error"]) return if fmt == 'vrt' or fmt == 'cwb': make_settings = [fmt] + make_settings self.out_file = os.path.join(self.annotations_dir, self.filename + '.vrt') else: make_settings = ['export'] + make_settings self.out_file = os.path.join(self.export_dir, self.filename + '.xml') # Do a dry run to get the number of invocations that will be made stdout, stderr = make(make_settings + ['--dry-run']).communicate("") self.stderr = stderr.decode(UTF8) assert(self.stderr == "") steps = stdout.decode(UTF8).count(Config.python_interpreter) # No remote installations allowed os.environ['remote_cwb_datadir'] = "null" os.environ['remote_cwb_registry'] = "null" os.environ['remote_host'] = "null" # Now, make! self.make_process = make(make_settings) self.change_status(Status.Running) # Process the output from make self.change_step(new_cmd="", new_step=0, new_steps=steps + 1) step = 0 for line in iter(self.make_process.stdout.readline, b''): line = line.decode(UTF8) self.make_out.append(line) if Config.python_interpreter in line: step += 1 argstring = line.split(Config.python_interpreter)[1] arguments = argstring.lstrip().split() command = " ".join(arguments[1:3]) if "--" in arguments[3] else arguments[1] self.change_step(new_step=step, new_cmd=command) self.change_step(new_cmd="", new_step=step + 1) send_warnings() # The corpus should now be in self.out_file # Its contents are not stored because of memory reasons # assert os.path.isfile(self.out_file) self.make_process.stdout.close() self.make_process.stderr.close() self.make_process.wait() self.change_status(Status.Done)