Пример #1
0
 def _build_all(self):
     from taucmdr.cf.platforms import TauMagic
     targets = set([(magic.architecture, magic.operating_system) for magic in TauMagic.all()])
     for target in targets:
         targ_arch, targ_os = target
         # Setuptools is a dirty, stateful animal.
         # Have to create a new subprocess to hack around setuptools' stateful implementation of sdist.
         subprocess.call(['python', 'setup.py', 'release', 
                          '--target-arch', str(targ_arch),
                          '--target-os', str(targ_os)])
     subprocess.call(['python', 'setup.py', 'release', '--web'])
Пример #2
0
 def _build_all(self):
     from taucmdr.cf.platforms import TauMagic
     targets = {(magic.architecture, magic.operating_system)
                for magic in TauMagic.all()}
     for target in targets:
         targ_arch, targ_os = target
         # Setuptools is a dirty, stateful animal.
         # Have to create a new subprocess to hack around setuptools' stateful implementation of sdist.
         subprocess.call([
             'python', 'setup.py', 'release', '--target-arch',
             str(targ_arch), '--target-os',
             str(targ_os)
         ])
     subprocess.call(['python', 'setup.py', 'release', '--web'])
Пример #3
0
 def _parse_tau_makefile(self, args):
     # Parsing a TAU Makefile is a really hairy operation, so let's lift the limits
     # pylint: disable=too-many-statements,too-many-locals
     makefile = args.forced_makefile
     if not util.path_accessible(makefile):
         self.parser.error("Invalid TAU makefile: %s" % makefile)
     tau_arch_name = os.path.basename(
         os.path.dirname(os.path.dirname(makefile)))
     matches = [
         arch for arch in TauMagic.all() if arch.name == tau_arch_name
     ]
     if len(matches) == 1:
         tau_arch = matches[0]
     elif not matches:
         raise ConfigurationError(
             "TAU Makefile '%s' targets an unrecognized TAU architecture: %s"
             % (makefile, tau_arch_name))
     else:
         for arch in matches:
             if arch.architecture == HOST_ARCH and arch.operating_system == HOST_OS:
                 tau_arch = arch
                 break
         else:
             parts = [
                 "TAU Makefile '%s' targets an ambiguous TAU architecture: %s"
                 % (makefile, tau_arch_name), "It could be any of these:"
             ]
             parts.extend([
                 "  - %s on %s" %
                 (arch.operating_system.name, arch.architecture.name)
                 for arch in matches
             ])
             raise ConfigurationError("\n".join(parts))
     self.logger.info(
         "Parsing TAU Makefile '%s' to populate command line arguments:",
         makefile)
     args.host_arch = tau_arch.architecture.name
     self.logger.info("  --host-arch='%s'", args.host_arch)
     args.host_os = tau_arch.operating_system.name
     self.logger.info("  --host-os='%s'", args.host_os)
     args.tau_source = os.path.abspath(
         os.path.join(os.path.dirname(makefile), '..', '..'))
     self.logger.info("  --taucmdr='%s'", args.tau_source)
     with open(makefile, 'r') as fin:
         compiler_parts = ("FULL_CC", "FULL_CXX", "TAU_F90")
         package_parts = {
             "BFDINCLUDE":
             ("binutils_source",
              lambda x: os.path.dirname(shlex.split(x)[0].lstrip("-I"))),
             "UNWIND_INC": ("libunwind_source",
                            lambda x: os.path.dirname(x.lstrip("-I"))),
             "PAPIDIR": ("papi_source", os.path.abspath),
             "PDTDIR": ("pdt_source", os.path.abspath),
             "SCOREPDIR": ("scorep_source", os.path.abspath)
         }
         tau_r = ''
         for line in fin:
             if line.startswith('#'):
                 continue
             try:
                 key, val = [x.strip() for x in line.split('=', 1)]
             except ValueError:
                 continue
             if key == 'TAU_R':
                 tau_r = val.split()[0]
             elif key in compiler_parts:
                 path = util.which(val.strip().split()[0].replace(
                     '$(TAU_R)', tau_r))
                 if not path:
                     self.logger.warning(
                         "Failed to parse %s in TAU Makefile '%s'", key,
                         makefile)
                     continue
                 matching_info = Knowledgebase.find_compiler(
                     os.path.basename(path))
                 if matching_info:
                     if len(matching_info) > 1:
                         self.logger.warning(
                             "Ambiguous compiler '%s' in TAU Makefile '%s'",
                             path, makefile)
                     comp = InstalledCompiler(path, matching_info[0])
                     attr = comp.info.role.keyword
                     setattr(args, attr, comp.absolute_path)
                     self.logger.info("  --%s='%s'",
                                      attr.lower().replace("_", "-"),
                                      comp.absolute_path)
                     while comp.wrapped:
                         comp = comp.wrapped
                         attr = comp.info.role.keyword
                         setattr(args, attr, comp.absolute_path)
                         self.logger.info("  --%s='%s'",
                                          attr.lower().replace("_", "-"),
                                          comp.absolute_path)
             elif key in package_parts:
                 attr, operator = package_parts[key]
                 path = val.strip()
                 if not path:
                     path = None
                 else:
                     path = operator(path)
                     if not os.path.exists(path):
                         self.logger.warning(
                             "'%s' referenced by TAU Makefile '%s' doesn't exist",
                             path, makefile)
                         continue
                 setattr(args, attr, path)
                 self.logger.info("  --%s='%s'",
                                  attr.replace("_source", ""), path)
Пример #4
0
 def _parse_tau_makefile(self, args):
     # Parsing a TAU Makefile is a really hairy operation, so let's lift the limits
     # pylint: disable=too-many-statements,too-many-locals
     makefile = args.forced_makefile
     if not util.path_accessible(makefile):
         self.parser.error("Invalid TAU makefile: %s" % makefile)
     tau_arch_name = os.path.basename(os.path.dirname(os.path.dirname(makefile)))
     matches = [arch for arch in TauMagic.all() if arch.name == tau_arch_name]
     if len(matches) == 1:
         tau_arch = matches[0]
     elif len(matches) == 0:
         raise ConfigurationError("TAU Makefile '%s' targets an unrecognized TAU architecture: %s" % 
                                  (makefile, tau_arch_name))
     else:
         for arch in matches:
             if arch.architecture == HOST_ARCH and arch.operating_system == HOST_OS:
                 tau_arch = arch
                 break
         else:
             parts = ["TAU Makefile '%s' targets an ambiguous TAU architecture: %s" % (makefile, tau_arch_name),
                      "It could be any of these:"]
             parts.extend(["  - %s on %s" % (arch.operating_system.name, arch.architecture.name) 
                           for arch in matches])
             raise ConfigurationError("\n".join(parts))
     self.logger.info("Parsing TAU Makefile '%s' to populate command line arguments:", makefile)
     args.host_arch = tau_arch.architecture.name
     self.logger.info("  --host-arch='%s'", args.host_arch)
     args.host_os = tau_arch.operating_system.name
     self.logger.info("  --host-os='%s'", args.host_os)
     args.tau_source = os.path.abspath(os.path.join(os.path.dirname(makefile), '..', '..'))
     self.logger.info("  --taucmdr='%s'", args.tau_source)
     with open(makefile, 'r') as fin:
         compiler_parts = ("FULL_CC", "FULL_CXX", "TAU_F90")
         package_parts = {"BFDINCLUDE": ("binutils_source", lambda x: os.path.dirname(x.lstrip("-I"))), 
                          "UNWIND_INC": ("libunwind_source", lambda x: os.path.dirname(x.lstrip("-I"))),
                          "PAPIDIR": ("papi_source", os.path.abspath),
                          "PDTDIR": ("pdt_source", os.path.abspath),
                          "SCOREPDIR": ("scorep_source", os.path.abspath)}
         tau_r = ''
         for line in fin:
             if line.startswith('#'):
                 continue
             try:
                 key, val = [x.strip() for x in line.split('=', 1)]
             except ValueError:
                 continue
             if key == 'TAU_R':
                 tau_r = val.split()[0]
             elif key in compiler_parts:
                 path = util.which(val.strip().split()[0].replace('$(TAU_R)', tau_r))
                 if not path:
                     self.logger.warning("Failed to parse %s in TAU Makefile '%s'", key, makefile)
                     continue
                 matching_info = Knowledgebase.find_compiler(os.path.basename(path))
                 if matching_info:
                     if len(matching_info) > 1:
                         self.logger.warning("Ambiguous compiler '%s' in TAU Makefile '%s'", path, makefile)
                     comp = InstalledCompiler(path, matching_info[0])
                     attr = comp.info.role.keyword
                     setattr(args, attr, comp.absolute_path)
                     self.logger.info("  --%s='%s'", attr.lower().replace("_", "-"), comp.absolute_path)
                     while comp.wrapped:
                         comp = comp.wrapped
                         attr = comp.info.role.keyword
                         setattr(args, attr, comp.absolute_path)
                         self.logger.info("  --%s='%s'", attr.lower().replace("_", "-"), comp.absolute_path)
             elif key in package_parts:
                 attr, operator = package_parts[key]
                 path = val.strip()
                 if not path:
                     path = None
                 else:
                     path = operator(path)
                     if not os.path.exists(path):
                         self.logger.warning("'%s' referenced by TAU Makefile '%s' doesn't exist", path, makefile)
                         continue
                 setattr(args, attr, path)
                 self.logger.info("  --%s='%s'", attr.replace("_source", ""), path)