示例#1
0
文件: Build.py 项目: blablack/ams-lv2
	def progress_line(self, idx, total, col1, col2):
		"""
		Computes a progress bar line displayed when running ``waf -p``

		:returns: progress bar line
		:rtype: string
		"""
		if not sys.stderr.isatty():
			return ''

		n = len(str(total))

		Utils.rot_idx += 1
		ind = Utils.rot_chr[Utils.rot_idx % 4]

		pc = (100. * idx)/total
		fs = "[%%%dd/%%d][%%s%%2d%%%%%%s][%s][" % (n, ind)
		left = fs % (idx, total, col1, pc, col2)
		right = '][%s%s%s]' % (col1, self.timer, col2)

		cols = Logs.get_term_cols() - len(left) - len(right) + 2*len(col1) + 2*len(col2)
		if cols < 7:
			cols = 7

		ratio = ((cols * idx)//total) - 1

		bar = ('='*ratio+'>').ljust(cols)
		msg = Logs.indicator % (left, bar, right)

		return msg
示例#2
0
文件: Build.py 项目: kenmasumitsu/waf
	def progress_line(self, state, total, col1, col2):
		"""
		Compute the progress bar used by ``waf -p``
		"""
		if not sys.stderr.isatty():
			return ''

		n = len(str(total))

		Utils.rot_idx += 1
		ind = Utils.rot_chr[Utils.rot_idx % 4]

		pc = (100.*state)/total
		eta = str(self.timer)
		fs = "[%%%dd/%%%dd][%%s%%2d%%%%%%s][%s][" % (n, n, ind)
		left = fs % (state, total, col1, pc, col2)
		right = '][%s%s%s]' % (col1, eta, col2)

		cols = Logs.get_term_cols() - len(left) - len(right) + 2*len(col1) + 2*len(col2)
		if cols < 7: cols = 7

		ratio = ((cols*state)//total) - 1

		bar = ('='*ratio+'>').ljust(cols)
		msg = Logs.indicator % (left, bar, right)

		return msg
	def __init__(self, ctx):
		optparse.OptionParser.__init__(self, conflict_handler="resolve", version='waf %s (%s)' % (Context.WAFVERSION, Context.WAFREVISION))

		self.formatter.width = Logs.get_term_cols()
		p = self.add_option
		self.ctx = ctx

		jobs = ctx.jobs()
		p('-j', '--jobs',     dest='jobs',    default=jobs, type='int', help='amount of parallel jobs (%r)' % jobs)
		p('-k', '--keep',     dest='keep',    default=0,     action='count', help='keep running happily even if errors are found')
		p('-v', '--verbose',  dest='verbose', default=0,     action='count', help='verbosity level -v -vv or -vvv [default: 0]')
		p('--nocache',        dest='nocache', default=False, action='store_true', help='ignore the WAFCACHE (if set)')
		p('--zones',          dest='zones',   default='',    action='store', help='debugging zones (task_gen, deps, tasks, etc)')

		gr = optparse.OptionGroup(self, 'configure options')
		self.add_option_group(gr)

		gr.add_option('-o', '--out', action='store', default='', help='build dir for the project', dest='out')
		gr.add_option('-t', '--top', action='store', default='', help='src dir for the project', dest='top')

		default_prefix = os.environ.get('PREFIX')
		if not default_prefix:
			if platform == 'win32':
				d = tempfile.gettempdir()
				default_prefix = d[0].upper() + d[1:]
				# win32 preserves the case, but gettempdir does not
			else:
				default_prefix = '/usr/local/'
		gr.add_option('--prefix', dest='prefix', default=default_prefix, help='installation prefix [default: %r]' % default_prefix)
		gr.add_option('--download', dest='download', default=False, action='store_true', help='try to download the tools if missing')


		gr = optparse.OptionGroup(self, 'build and install options')
		self.add_option_group(gr)

		gr.add_option('-p', '--progress', dest='progress_bar', default=0, action='count', help= '-p: progress bar; -pp: ide output')
		gr.add_option('--targets',        dest='targets', default='', action='store', help='task generators, e.g. "target1,target2"')

		gr = optparse.OptionGroup(self, 'step options')
		self.add_option_group(gr)
		gr.add_option('--files',          dest='files', default='', action='store', help='files to process, by regexp, e.g. "*/main.c,*/test/main.o"')

		default_destdir = os.environ.get('DESTDIR', '')
		gr = optparse.OptionGroup(self, 'install/uninstall options')
		self.add_option_group(gr)
		gr.add_option('--destdir', help='installation root [default: %r]' % default_destdir, default=default_destdir, dest='destdir')
		gr.add_option('-f', '--force', dest='force', default=False, action='store_true', help='force file installation')

		gr.add_option('--distcheck-args', help='arguments to pass to distcheck', default=None, action='store')
示例#4
0
文件: review.py 项目: AleemDev/waf
	def display_review_set(self, review_set):
		"""
		Return the string representing the review set specified.
		"""
		term_width = Logs.get_term_cols()
		lines = []
		for dest in review_options.keys():
			opt = review_options[dest]
			name = ", ".join(opt._short_opts + opt._long_opts)
			help = opt.help
			actual = None
			if dest in review_set: actual = review_set[dest]
			default = review_defaults[dest]
			lines.append(self.format_option(name, help, actual, default, term_width))
		return "Configuration:\n\n" + "\n\n".join(lines) + "\n"
示例#5
0
文件: Build.py 项目: RunarFreyr/waz
	def progress_line(self,state,total,col1,col2):
		n=len(str(total))
		Utils.rot_idx+=1
		ind=Utils.rot_chr[Utils.rot_idx%4]
		pc=(100.*state)/total
		eta=str(self.timer)
		fs="[%%%dd/%%%dd][%%s%%2d%%%%%%s][%s]["%(n,n,ind)
		left=fs%(state,total,col1,pc,col2)
		right='][%s%s%s]'%(col1,eta,col2)
		cols=Logs.get_term_cols()-len(left)-len(right)+2*len(col1)+2*len(col2)
		if cols<7:cols=7
		ratio=int((cols*state)/total)-1
		bar=('='*ratio+'>').ljust(cols)
		msg=Utils.indicator%(left,bar,right)
		return msg
示例#6
0
 def progress_line(self, state, total, col1, col2):
     if not sys.stderr.isatty():
         return ""
     n = len(str(total))
     Utils.rot_idx += 1
     ind = Utils.rot_chr[Utils.rot_idx % 4]
     pc = (100.0 * state) / total
     eta = str(self.timer)
     fs = "[%%%dd/%%%dd][%%s%%2d%%%%%%s][%s][" % (n, n, ind)
     left = fs % (state, total, col1, pc, col2)
     right = "][%s%s%s]" % (col1, eta, col2)
     cols = Logs.get_term_cols() - len(left) - len(right) + 2 * len(col1) + 2 * len(col2)
     if cols < 7:
         cols = 7
     ratio = ((cols * state) // total) - 1
     bar = ("=" * ratio + ">").ljust(cols)
     msg = Logs.indicator % (left, bar, right)
     return msg
	def __init__(self,ctx):
		optparse.OptionParser.__init__(self,conflict_handler="resolve",version='waf %s (%s)'%(Context.WAFVERSION,Context.WAFREVISION))
		self.formatter.width=Logs.get_term_cols()
		self.ctx=ctx
示例#8
0
文件: Options.py 项目: afeldman/waf
	def __init__(self, ctx, allow_unknown=False):
		optparse.OptionParser.__init__(self, conflict_handler='resolve', add_help_option=False,
			version='waf %s (%s)' % (Context.WAFVERSION, Context.WAFREVISION))
		self.formatter.width = Logs.get_term_cols()
		self.ctx = ctx
		self.allow_unknown = allow_unknown
示例#9
0
    def __init__(self, ctx):
        optparse.OptionParser.__init__(
            self,
            conflict_handler="resolve",
            version='waf %s (%s)' % (Context.WAFVERSION, Context.WAFREVISION))

        self.formatter.width = Logs.get_term_cols()
        p = self.add_option
        self.ctx = ctx

        jobs = ctx.jobs()
        p('-j',
          '--jobs',
          dest='jobs',
          default=jobs,
          type='int',
          help='amount of parallel jobs (%r)' % jobs)
        p('-k',
          '--keep',
          dest='keep',
          default=0,
          action='count',
          help='keep running happily even if errors are found')
        p('-v',
          '--verbose',
          dest='verbose',
          default=0,
          action='count',
          help='verbosity level -v -vv or -vvv [default: 0]')
        p('--nocache',
          dest='nocache',
          default=False,
          action='store_true',
          help='ignore the WAFCACHE (if set)')
        p('--zones',
          dest='zones',
          default='',
          action='store',
          help='debugging zones (task_gen, deps, tasks, etc)')

        gr = optparse.OptionGroup(self, 'configure options')
        self.add_option_group(gr)

        gr.add_option('-o',
                      '--out',
                      action='store',
                      default='',
                      help='build dir for the project',
                      dest='out')
        gr.add_option('-t',
                      '--top',
                      action='store',
                      default='',
                      help='src dir for the project',
                      dest='top')

        default_prefix = os.environ.get('PREFIX')
        if not default_prefix:
            if platform == 'win32':
                d = tempfile.gettempdir()
                default_prefix = d[0].upper() + d[1:]
                # win32 preserves the case, but gettempdir does not
            else:
                default_prefix = '/usr/local/'
        gr.add_option('--prefix',
                      dest='prefix',
                      default=default_prefix,
                      help='installation prefix [default: %r]' %
                      default_prefix)
        gr.add_option('--download',
                      dest='download',
                      default=False,
                      action='store_true',
                      help='try to download the tools if missing')

        gr = optparse.OptionGroup(self, 'build and install options')
        self.add_option_group(gr)

        gr.add_option('-p',
                      '--progress',
                      dest='progress_bar',
                      default=0,
                      action='count',
                      help='-p: progress bar; -pp: ide output')
        gr.add_option('--targets',
                      dest='targets',
                      default='',
                      action='store',
                      help='task generators, e.g. "target1,target2"')
        gr.add_option('-s',
                      '--sig-delta',
                      dest='generate_sig_debug_output',
                      default=False,
                      action='store_true',
                      help='output what deltas caused a task to rerun')

        gr = optparse.OptionGroup(self, 'step options')
        self.add_option_group(gr)
        gr.add_option(
            '--files',
            dest='files',
            default='',
            action='store',
            help='files to process, by regexp, e.g. "*/main.c,*/test/main.o"')

        default_destdir = os.environ.get('DESTDIR', '')
        gr = optparse.OptionGroup(self, 'install/uninstall options')
        self.add_option_group(gr)
        gr.add_option('--destdir',
                      help='installation root [default: %r]' % default_destdir,
                      default=default_destdir,
                      dest='destdir')
        gr.add_option('-f',
                      '--force',
                      dest='force',
                      default=False,
                      action='store_true',
                      help='force file installation')

        gr.add_option('--distcheck-args',
                      help='arguments to pass to distcheck',
                      default=None,
                      action='store')
示例#10
0
	def __init__(self, ctx, allow_unknown=False):
		optparse.OptionParser.__init__(self, conflict_handler='resolve', add_help_option=False,
			version='%s %s (%s)' % (Context.WAFNAME, Context.WAFVERSION, Context.WAFREVISION))
		self.formatter.width = Logs.get_term_cols()
		self.ctx = ctx
		self.allow_unknown = allow_unknown