def print_table(data): python27 = mbuild.check_python_version(2, 7) fmt_str27 = "{0:10s} {1:10,d} Bytes {2:5.2f} MB {3:10.2f}%" fmt_str = "%10s %10d Bytes %5.2f MB %10.2f%%" keys = list(data.keys()) keys.sort() total = 0 for k in keys: total = total + data[k] for k in keys: try: # avoid div/0 pct = 100.0 * data[k] / total except: pct = 0 mb = data[k] / 1024.0 / 1024.0 if python27: print(fmt_str27.format(k, data[k], mb, pct)) else: print(fmt_str % (k, data[k], mb, pct)) mb = total / 1024.0 / 1024.0 if python27: print(fmt_str27.format('total', total, mb, 100)) else: print(fmt_str % ('total', total, mb, 100))
def _find_doxygen(env): """Find the right version of doxygen. Return a tuple of the command name and a boolean indicating whether or not the version checked out.""" if env['doxygen_cmd'] == '': doxygen_cmd_intel = "/usr/intel/bin/doxygen" doxygen_cmd_cygwin = "C:/cygwin/bin/doxygen" doxygen_cmd_mac = \ "/Applications/Doxygen.app/Contents/Resources/doxygen" doxygen_cmd = "doxygen" if env['build_os'] == 'win': if os.path.exists(doxygen_cmd_cygwin): doxygen_cmd = doxygen_cmd_cygwin else: mbuild.msgb( 'DOXYGEN', "Could not find cygwin's doxygen," + "trying doxygen from PATH") elif env['build_os'] == 'lin': if mbuild.verbose(1): mbuild.msgb("CHECKING FOR", doxygen_cmd_intel) if os.path.exists(doxygen_cmd_intel): doxygen_cmd = doxygen_cmd_intel elif env['build_os'] == 'mac': if mbuild.verbose(1): mbuild.msgb("CHECKING FOR", doxygen_cmd_mac) if os.path.exists(doxygen_cmd_mac): doxygen_cmd = doxygen_cmd_mac else: doxygen_cmd = env['doxygen_cmd'] doxygen_cmd = env.escape_string(doxygen_cmd) doxygen_okay = False if mbuild.verbose(1): mbuild.msgb('Checking doxygen version', '...') if mbuild.check_python_version(2, 4): try: (retval, output, error_output) = \ mbuild.run_command(doxygen_cmd + " --version") if retval == 0: if len(output) > 0: first_line = output[0].strip() if mbuild.verbose(1): mbuild.msgb("Doxygen version", first_line) doxygen_okay = _doxygen_version_okay(first_line, 1, 4, 6) else: for o in output: mbuild.msgb("Doxygen-version-check STDOUT", o) if error_output: for line in error_output: mbuild.msgb("STDERR ", line.rstrip()) except: mbuild.die("Doxygen required by the command line options " + "but no doxygen found") return (doxygen_cmd, doxygen_okay)
def mkenv(): """External entry point: create the environment""" if not mbuild.check_python_version(2, 7): xbc.cdie("Need python 2.7.x...") # create an environment, parse args env = mbuild.env_t() standard_defaults = dict(doxygen_install='', doxygen='', clean=False, die_on_errors=True, xed_messages=False, xed_asserts=False, pedantic=True, clr=False, use_werror=True, dbghelp=False, install_dir='', kit_kind='base', win=False, dev=False, legal_header=None, encoder=True, decoder=True, ld_library_path=[], ld_library_path_for_tests=[], use_elf_dwarf=False, use_elf_dwarf_precompiled=False, strip='strip', verbose=1, example_linkflags='', example_flags='', example_rpaths=[], android=False, xed_inc_dir='', xed_lib_dir='', xed_dir='', build_cpp_examples=False, set_copyright=False, pin_crt='') env['xed_defaults'] = standard_defaults env.set_defaults(env['xed_defaults']) return env