Beispiel #1
0
            else:
                raise Exception()
    except SystemExit:
        raise
    except:
        if globls.debug:
            traceback.print_exc()
        utils.print_exit("error: bad/missing argument(s)")

    try:
        domain = Domain(domain_home)
        if show_installed:
            # TODO: should paths or names be shown for installed and published?
            print("%s" % "\n".join(domain.get_installed()))
        if show_label:
            print("%s" % str(domain.get_label()))
        if show_published:
            print("%s" % "\n".join(domain.get_published()))
        if show_sources:
            print("%s" % str(domain.get_sources()))
        if show_subdomains:
            print("\n".join(domain.get_subdomains()))
        if show_version:
            version = domain.get_version()
            version_string = ".".join(map(str, version))
            print("%s" % version_string)
    except SystemExit:
        raise
    except utils.SSMExitException, detail:
        utils.print_exit(detail)
    except:
Beispiel #2
0
                            paths = find_in_lib(domain_home, term)
                        elif find_type == "name":
                            paths = find_name(domain_home, term, depth)
                    elif find_type == "package":
                        package_names = domain.get_package_names(term)
                        if output_type == "long":
                            paths = sorted([
                                os.path.join(domain_home, name)
                                for name in package_names
                            ])
                    else:
                        utils.print_exit("error: unknown find type")

                    if package_names or paths:
                        print "==========  %s (%s)  ==========" % (
                            domain_home, domain.get_label())

                    if output_type == "long":
                        for path in paths:
                            if find_type == "package":
                                package_name = path[len(domain_home) +
                                                    1:].split("/", 1)[0]
                                print "%s" % (package_name, )
                            else:
                                print "%s" % (path, )
                        if paths:
                            print
                    elif output_type == "summary":
                        fmt = "%-2s %-30s"
                        lines = []
                        published_platforms = domain.get_published_platforms()
Beispiel #3
0
             domain = Domain(domain_home)
             package_names = domain.get_package_names()
             platforms = set(
                 [name.split("_", 2)[-1] for name in package_names] +
                 domain.get_published_platforms())
             for platform in sorted(platforms):
                 lines = []
                 for record in get_output_records(domain_home, platform,
                                                  format_fields):
                     if output_type == "format":
                         lines.append(fmt % sep.join(record))
                     else:
                         lines.append(fmt % tuple(record))
                 if output_type == "summary":
                     print "==========  %s (%s) (%s)  ==========" % (
                         domain_home, domain.get_label(), platform)
                     utils.print_columns(lines, None,
                                         utils.get_terminal_size()[1])
                 else:
                     for line in lines:
                         print(line)
         except SystemExit:
             raise
         except utils.SSMExitException, detail:
             utils.print_exit(detail)
         except:
             if globls.debug:
                 traceback.print_exc()
             # TODO: this does not seem to be a good error
             utils.print_exit("error: could not access domain information")
 sys.exit(0)